Compiling and installing httpd-2.4

Source: Internet
Author: User

Installation of httpd-2.4

The experimental environment for centOS6.5, due to centOS6 on the library files and development tools such as not suitable for installing httpd-2.4, so need to manually install the two packages APR and apr-util,httpd-2.4 dependent on the 1.4 version of APR and Apr-util. Here's a brief introduction to Apr.

About APR

Apr (Apache portable runtime), Apache's Portable operating environment, Apache applications need to be developed according to different platforms due to the different underlying environments, and APR eliminates the difference between the underlying platforms, APR is capable of providing all APR feature support for most platforms, including Beos,unix,linux and so on, APR provides a common unified operation function interface for most of these platforms, so that the interfaces of Apache applications on different platforms are basically uniform and consistent.

Compiling the installation

Download the source Package

-rw-r--r--1 root root 813976 Jul 1 09:09 apr-1.5.0.tar.bz2-rw-r--r--1 root root 695303 Jul 1 09:09 apr-util-1.5.3. tar.bz2-rw-r--r--1 root root 4994460 Jul 1 09:09 httpd-2.4.9.tar.bz2

1) Compile and install apr-1.5.0

[Email protected] ~]# tar xf apr-1.5.0.tar.bz2 [[email protected] ~]# CD Apr-1.5.0[[email protected] apr-1.5.0]#./config Ure--prefix=/usr/local/apr-1.5.0checking build system Type ... x86_64-unknown-linux-gnuchecking host system type ... x86 _64-unknown-linux-gnuchecking target system Type ... x86_64-unknown-linux-gnuconfiguring APR library ..... ..... [[email protected] apr-1.5.0]# make && make install

2) Compile and install apr-util-1.5.3

[[email protected] ~]# tar xf  apr-util-1.5.3.tar.bz2 [[email protected] ~]# cd apr-util-1.5.3[[email protected ] apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util-1.5.3/ --with-apr=/usr/local/ apr-1.5.0/checking build system type... x86_64-unknown-linux-gnuchecking host  system type... x86_64-unknown-linux-gnuchecking target system type... x86_64- unknown-linux-gnuchecking for a bsd-compatible install... /usr/bin/install - Cchecking for working mkdir -p... yes ........ [[Email protected] apr-util-1.5.3]# make && make install 

Since Apr-util relies on APR, it is necessary to specify the installed Apr by "--WITH-APR" when installing Apr-util.


2) Compile and install httpd-2.4.9

[Email protected] ~]# tar xf httpd-2.4.9.tar.bz2 [[email protected] ~]# CD Httpd-2.4.9[[email protected] httpd-2.4.9]#. /configure--prefix=/usr/local/apache2.4.9--sysconfdir=/etc/httpd--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--with-zlib--with-pcre--with-apr=/usr/local/apr-1.5.0--with-apr-util=/usr/local/apr-util-1.5.3-- Enable-mpms-shared=all--with-mpm=event--enable-modules=most ...... [[email protected] httpd-2.4.9]# make && make install

A brief introduction to the various parameters involved:

--prefix=/usr/local/apache2.4.9 #应用程序安装路径

--SYSCONFDIR=/ETC/HTTPD #配置文件的安装路径

--enable-so #支持DSO动态装载模块

--enable-ssl #要编译启用ssl模块 (if you need to install Openssl-devel)

--enable-cgi #启用CGI模块 (enabled by default)

--enable-rewrite #URL重写 (the URL that the user accesses is automatically changed from the server to another URL, which is a very

#用的机制)

--with-zlib #这是一个压缩库 (dedicated for network transmission)

--with-pcre #使用增强的 Perl Regular Expression Analysis tool (use this to install Pcre-devel,pcre:

#正则表达式分析器)

--WITH-APR=/USR/LOCAL/APR #指明apr的目录 (if APR is in a special path)

--with-apr-util=/usr/local/apr-util/#指明apr-util Path (if apr-util under special path)

--enable-mpms-shared=all #把所有的mpm模块都编译进来而且是共享模块

--with-mpm=event #默认使用的mpm模块

--enable-modules=most|all #还有很多其他模块, the other dynamic loadable modules need to compile which

# (all: Compile, most: compile some common modules)

[Email protected] profile.d]# vim/etc/profile.d/apache.sh export path=/usr/local/apache2.4.9/bin: $PATH [[Email Protected] profile.d]#. /etc/profile.d/apache.sh

Add the Apache application Bin directory to the PATH environment variable. Because is the compilation installs, therefore does not have the corresponding script file in the/ETC/INIT.D directory, needs to write itself, does not write, directly the RPM package installs automatically generates the script file httpd to copy over, changes several of these parameters.

#!/bin/bash## httpd        startup script for the  Apache HTTP Server## chkconfig: - 85 15# description: The  apache http server is an efficient and extensible  #               server implementing the  current http standards.# processname: httpd# config: /etc/httpd/httpd.conf # pidfile: /usr/local/apache2.4.9/logs/httpd.pid#### begin init info# provides:  httpd# Required-Start:  $local _fs  $remote _fs  $network   $named # required-stop :  $local _fs  $remote _fs  $network # should-start: distcache# short-description:  start and stop Apache HTTP Server# Description: The Apache  Http server is an extensible server #  implementing the current http  Standards.### end init info# source function library.  /etc/rc.d/init.d/functions#if [ -f /etc/sysconfig/httpd ]; then#         . /etc/sysconfig/httpd#fi# start httpd in the  c locale by default. httpd_lang=${httpd_lang-"C"}# this will prevent initlog from swallowing up  a pass-phrase prompt if# mod_ssl needs a pass-phrase from  The user. Initlog_args= "" # set httpd=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use  a server# with the thread-based  "Worker"  MPM; BE WARNED  that some modules may not# work correctly with a thread-based&nbsp mpm; notably php will refuse to start.# path to the  Apachectl script, server binary, and short-form for messages.apachectl=/usr /local/apache2.4.9/bin/apachectlhttpd=${httpd-/usr/local/apache2.4.9/bin/httpd}prog=httpdpidfile=${pidfile-/ Usr/local/apache2.4.9/logs/httpd.pid}lockfile=${lockfile-/var/lock/subsys/httpd}retval=0stop_timeout=${stop_ Timeout-10}# the semantics of these two functions differ from the  way apachectl does# things -- attempting to start while  Running is a failure, and shutdown# when not running is also  a failure.  so we just do it the way init scripts # are expected to behave here.start ()  {         echo -n $ "starting  $prog: "         lang= $HTTPD _lang daemon  --pidfile=${pidfile}  $httpd   $OPTIONS         retval=$?         echo        [ $ retval = 0 ] && touch ${lockfile}         return  $RETVAL}# when stopping httpd, a delay  (of default  10 second)  is required# before SIGKILLing the httpd parent;  this gives enough time for the# httpd parent to sigkill  any errant children.stop ()  {        echo -n  $ "stopping  $prog: "         killproc -p ${ pidfile} -d ${stop_timeout}  $httpd         RETVAL=$?         echo        [  $RETVAL  = 0 ]  && rm -f ${lockfile} ${pidfile}}reload ()  {    echo  -n $ "reloading  $prog: "     if ! lang= $HTTPD _lang $ httpd  $OPTIONS  -t >&/dev/null; then         retval=6        echo $ "not reloading due to  Configuration syntax error "        failure $" not  reloading  $httpd  due to configuration syntax error "    else         # force lsb behaviour from killproc         lsb=1 killproc -p ${pidfile}  $httpd  -HUP         RETVAL=$?        if [  $RETVAL  - Eq 7 ]; then            failure  $ "Httpd shutdown"         fi    fi     echo}# See how we were called.case  "$"  in   Start)         start        ;;   stop)         stop         ;;   status)         status -p ${pidfile}  $httpd         RETVAL=$?        ;;   resTart)         stop        start         ;;   condrestart|try-restart)         if status -p  ${pidfile}  $httpd  >&/dev/null; then                 stop                 start        fi         ;;   force-reload|reload)         reload         ;;   graceful|help|configtest|fullstatus)          $apachectl  [email protected]        RETVAL=$?         ;;   *)         echo $ "usage:  $prog  {start|stop| Restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest} "         RETVAL=2esacexit  $RETVAL

Apachectl=/usr/local/apache2.4.9/bin/apachectl

HTTPD=${HTTPD-/USR/LOCAL/APACHE2.4.9/BIN/HTTPD}

Pidfile=${pidfile-/usr/local/apache2.4.9/logs/httpd.pid}

Modified the above parameters, where the compiled installation of the application will pidfile placed in /usr/local/apache2.4.9/logs/, you can modify the PID file placement by Pidfile parameters in the main configuration file.

Pidfile "/var/run/httpd/httpd.pid"
[Email protected] bin]# chkconfig--add/etc/init.d/httpd [[email protected] bin]# chkconfig--list httpdhttpd 0 : Off1:off2:off3:off4:off5:off6:off

Start the service

[[email protected] logs]# service httpd  startstarting httpd:                                              [  ok  ][[email  protected] logs]# ss -tuln | grep 80tcp    listen      0      128                    :::80                    :::* 

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/30/wKiom1WUC3Kxc10xAACQLGtRMqM940.jpg "title=" 9}[]t ( C13a{t) fiw7gj_iom.png "alt=" Wkiom1wuc3kxc10xaacqlgtrmqm940.jpg "/>

Ok......


Catalogue Introduction

MPM Module Introduction

Compiling and installing httpd-2.4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.