Compile and install lamp (a)--compile and install httpd-2.4.4

Source: Internet
Author: User

1. Solve the dependency relationship
httpd-2.4.4 requires a newer version of APR (Apache Portable runtime) and apr-util, so it needs to be upgraded beforehand. There are two ways to upgrade, one is to compile the installation through source code, and the other is to upgrade the RPM package directly. Here you choose the way to compile the source code.
(1) Compile and install Apr

# Tar XF apr-1.4.6.tar.bz2# cd apr-1.4.6#./configure--prefix=/usr/local/apr# make && make instal

(2) Compile and install Apr-util

# Tar XF apr-util-1.5.2.tar.bz2# cd apr-util-1.5.2#./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR # Make && make instal

Attached: Apache Official introduction to Apr:
The mission of the Apache Portable Runtime (APR) project is to create and maintain software libraries that provide a Predi CTable and consistent interface to underlying PLATFORM-SPECIFIC implementations. The primary goal is to provide a API to which software developers may code and being assured of predictable if not identical Behaviour regardless of the platform on which their software are built, relieving them of the need to code Special-case CO Nditions to work around or take advantage of platform-specific deficiencies or features.
(3) The httpd-2.4.4 compilation process also relies on the Pcre-devel software package, which needs to be installed beforehand. This package system CD comes with it, so find and install it.


2. Compile and install httpd-2.4.4
First download httpd-2.4.4 to local. Then execute the following command to compile the installation process:

# tar xf httpd-2.4.4.tar.bz2# cd httpd-2.4.4#  ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so -- enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/ Local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=most  --with-mpm=event# make && make install 

Add:
(1) Build mpm as static module
in all platforms, MPM can be built as a static module. Select a mpm at build time, linked to the server. If you want to change MPM, you must rebuild it. In order to use the specified MPM, use the parameter--with-mpm=name when executing the Configure script. Name is the specified MPM name. After the compilation is complete, you can use./httpd-l to determine the selected MPM. This command lists all modules that are compiled into the server program, including MPM.
(2) constructing MPM as a dynamic module
in UNIX or similar platforms, MPM can be built as a dynamic module and loaded at run time as with other dynamic modules. Building MPM as a dynamic module allows you to change the MPM by modifying the contents of the LoadModule directive without rebuilding the server program. Use the--enable-mpms-shared option to enable this feature when you execute a configure script. All MPM modules supported by this platform will be installed when the given parameter is all. You can also give a list of modules in the parameters. The default MPM, which can be automatically selected or specified by the--WITH-MPM option when the Configure script is executed, then appears in the generated server configuration file. Edit the loadmodule instruction content to select a different mpm.

3, modify the httpd master profile, set the path of its PID file
Edit/etc/httpd/httpd.conf, add the following line:
pidfile  "/var/run/httpd.pid"

4, provide the SYSV service script/etc/rc.d/init.d/httpd, which reads as follows:

#!/bin/bash## httpd        startup script for the  apache http server## chkconfig: - 85 15# description: apache  is a world wide web server.  it is used to serve  #           html files and cgi.#  processname: httpd# config: /etc/httpd/conf/httpd.conf# config: /etc/sysconfig/ Httpd# pidfile: /var/run/httpd.pid# source function library.  /etc/rc.d/init.d/functionsif [ -f /etc/sysconfig/httpd ]; then         . /etc/sysconfig/httpdfi# start httpd in the  c locale by default. httpd_lang=${httpd_lang-"C"}# this will prevent initlog from swallowing up  a p Ass-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  MPM; notably PHP will refuse to start.# Path to the  Apachectl script, server binary, and short-form for messages.apachectl=/usr /local/apache/bin/apachectlhttpd=${httpd-/usr/local/apache/bin/httpd}prog=httpdpidfile=${pidfile-/var/run/ Httpd.pid}lockfile=${lockfile-/var/lock/subsys/httpd}retval=0start ()  {         echo -n $ "starting  $prog: "          lang= $HTTPD _lang daemon --pidfile=${pidfile}  $httpd   $OPTIONS         retval =$?        echo        [  $RETVAL  = 0 ] && touch ${lockfile}         return  $RETVAL}stop ()  {    echo -n $ "stopping  $prog:       killproc -p ${pidfile} -d 10  $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=$?         echo $ "Not reloading due to configuration syntax  error "        failure $" not reloading  $httpd  due to configuration syntax error "    else         killproc -p ${pidfile}  $httpd  -HUP         retval=$?    fi    echo}# see how  we were called.case  "$"  in  start)     start     ;;   stop)     stop    ;;   status)         status -p ${pidfile}  $httpd     RETVAL=$?    ;;   restart)     stop    start    ;;   condrestart)     if [ -f ${pidfile} ] ; then         stop        start     fi    ;;   reload)         reload    ;;   graceful|help|configtest|fullstatus)      $apachectl  [email protected]     RETVAL=$?    ;;   *)     echo $ "usage:  $prog  {start|stop|restart|condrestart| Reload|status|fullstatus|graceful|help|configtest} "    exit 1esacexit  $RETVAL


Then give execute permission for this script:

# chmod +X/ETC/RC.D/INIT.D/HTTPD

Join the Service list:

# chkconfig--add httpd

The next step is to start the service and test it.

Compile and install lamp (a)--compile and install httpd-2.4.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.