久久青草精品A片狠狠,日韩欧美视频一区二区,亚洲国码AV日韩,国产精品黄在

編譯安裝apache

2016-11-16 18:14:49 9759

1、解決依賴關(guān)系

httpd-2.4.4需要較新版本的aprapr-util,因此需要事先對(duì)其進(jìn)行升級(jí)。升級(jí)方式有兩種,一種是通過源代碼編譯安裝,一種是直接升級(jí)rpm包。

(1) 編譯安裝apr

# tar xf apr-1.4.6.tar.bz2

# cd apr-1.4.6

# ./configure --prefix=/usr/local/apr

# make && make install

 

(2) 編譯安裝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 install

 

/usr/local/apr-1.5.2

 

(3) httpd-2.4.4編譯過程也要依賴于pcre-devel軟件包,需要事先安裝。此軟件包系統(tǒng)光盤自帶,因此,找到并安裝即可。

 

2、編譯安裝httpd-2.4.4

到官網(wǎng)下載后執(zhí)行如下命令進(jìn)行編譯安裝過程:

 

# 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-1.5.2 --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=event

# make && make install

 

 

1)構(gòu)建

在全部平臺(tái)中,MPM都可以構(gòu)建為靜態(tài)模塊。在構(gòu)建時(shí)選擇一種MPM,鏈接到服務(wù)器中。如果要改變MPM,必須重新構(gòu)建。為了使用指定的MPM,請(qǐng)?jiān)趫?zhí)行configure腳本時(shí),使用參數(shù) --with-mpm=NAMENAME是指定的MPM名稱。編譯完成后,可以使用 ./httpd -l 來確定選擇的MPM 此命令會(huì)列出編譯到服務(wù)器程序中的所有模塊,包括 MPM

 

2)構(gòu)建 MPM 為動(dòng)態(tài)?塊

 

Unix或類似平臺(tái)中,MPM可以構(gòu)建為動(dòng)態(tài)模塊,與其它動(dòng)態(tài)模塊一樣在運(yùn)行時(shí)加載。 構(gòu)建 MPM 為動(dòng)態(tài)模塊允許通過修改LoadModule指令內(nèi)容來改變MPM,而不用重新構(gòu)建服務(wù)器程序。在執(zhí)行configure腳本時(shí),使用--enable-mpms-shared選項(xiàng)即可啟用此特性。當(dāng)給出的參數(shù)為all時(shí),所有此平臺(tái)支持的MPM模塊都會(huì)被安裝。還可以在參數(shù)中給出模塊列表。默認(rèn)MPM,可以自動(dòng)選擇或者在執(zhí)行configure腳本時(shí)通過--with-mpm選項(xiàng)來指定,然后出現(xiàn)在生成的服務(wù)器配置文件中。編輯LoadModule指令內(nèi)容可以選擇不同的MPM

 

 

3、修改httpd的主配置文件,設(shè)置其Pid文件的路徑

編輯/etc/httpd/httpd.conf,添加如下行即可:

PidFile  "/var/run/httpd.pid"

 

4、提供SysV服務(wù)腳本/etc/rc.d/init.d/httpd,內(nèi)容如下:

#!/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/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 MPM; notably PHP will refuse to start.

 

# Path to the apachectl script, server binary, and short-form for messages.

apachectl=/usr/local/apache/bin/apachectl

httpd=${HTTPD-/usr/local/apache/bin/httpd}

prog=httpd

pidfile=${PIDFILE-/var/run/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd}

RETVAL=0

 

start() {

        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 "$1" 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 $@

       RETVAL=$?

       ;;

  *)

       echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"

       exit 1

esac

 

exit $RETVAL

 

而后為此腳本賦予執(zhí)行權(quán)限:

# chmod +x /etc/rc.d/init.d/httpd

 

加入服務(wù)列表:

# chkconfig --add httpd

 



 

 


提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: