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

編譯安裝apache

2016-11-16 18:14:49 9157

1、解決依賴關系

httpd-2.4.4需要較新版本的aprapr-util,因此需要事先對其進行升級。升級方式有兩種,一種是通過源代碼編譯安裝,一種是直接升級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軟件包,需要事先安裝。此軟件包系統光盤自帶,因此,找到并安裝即可。

 

2、編譯安裝httpd-2.4.4

到官網下載后執行如下命令進行編譯安裝過程:

 

# 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)構建

在全部平臺中,MPM都可以構建為靜態模塊。在構建時選擇一種MPM,鏈接到服務器中。如果要改變MPM,必須重新構建。為了使用指定的MPM,請在執行configure腳本時,使用參數 --with-mpm=NAMENAME是指定的MPM名稱。編譯完成后,可以使用 ./httpd -l 來確定選擇的MPM 此命令會列出編譯到服務器程序中的所有模塊,包括 MPM

 

2)構建 MPM 為動態?塊

 

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

 

 

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

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

PidFile  "/var/run/httpd.pid"

 

4、提供SysV服務腳本/etc/rc.d/init.d/httpd,內容如下:

#!/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

 

而后為此腳本賦予執行權限:

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

 

加入服務列表:

# chkconfig --add httpd

 



 

 


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

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

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

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