日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

LAMP(三)之CentOS6编译安装httpd2.4

發(fā)布時間:2025/3/15 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 LAMP(三)之CentOS6编译安装httpd2.4 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

安裝前說明:

  httpd安裝依賴于apr-1.4+,apr-util-1.4+

  CentOS6上默認(rèn)是apr-1.3, apr-util-1.3

  先下載httpd2.4、apr-1.5和apr-util-1.5

  httpd下載地址:http://httpd.apache.org/download.cgi

  apr和apr-util下載地址:https://apr.apache.org/download.cgi

? 開始安裝:

  1. 安裝開發(fā)環(huán)境,安裝pcre-devel  

# yum install pcre-devel

  2. 安裝apr:下載路徑?https://apr.apache.org/download.cgi

# ./configure --prefix=/usr/local/apr --sysconfdir=/etc/apr # make && make install

? ? ? 3. 安裝apr-util:下載路徑?https://apr.apache.org/download.cgi

# ./configure prefix=/usr/local/apr-util --sysconfdir=/etc/apr-util --with-apr=/usr/local/apr # make && make install

  4. 安裝httpd-2.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=all --with-mpm=event # make && make install

  5. 啟動apache服務(wù)

  # /usr/local/bin/apachectl start
  或者添加PATH環(huán)境變量
    # vim /etc/profile.d/httpd.sh
      添加: export PATH=/usr/local/apache/bin:$PATH  //添加apache路徑
    # . /etc/profile.d/httpd.sh  //重讀配置文件
    # apachectl start
       Note: httpd: Could not reliably determine the server's fully qualified domain name,
          using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
         # ServerName localhost:80  //打開注釋

  6. 添加服務(wù)腳本: /etc/rc.d/init.d/httpd

#!/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/conf/httpd.conf # config: /etc/sysconfig/httpd # pidfile: /var/run/httpd/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/functionsif [ -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=/usr/local/apache/bin/httpd prog=httpd pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid} lockfile=${LOCKFILE-/var/lock/subsys/httpd} RETVAL=0 STOP_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 $OPTIONSRETVAL=$?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() {status -p ${pidfile} $httpd > /dev/nullif [[ $? = 0 ]]; thenecho -n $"Stopping $prog: "killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpdelseecho -n $"Stopping $prog: "successfiRETVAL=$?echo[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} }reload() {echo -n $"Reloading $prog: "if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; thenRETVAL=6echo $"not reloading due to configuration syntax error"failure $"not reloading $httpd due to configuration syntax error"else# Force LSB behaviour from killprocLSB=1 killproc -p ${pidfile} $httpd -HUPRETVAL=$?if [ $RETVAL -eq 7 ]; thenfailure $"httpd shutdown"fifiecho }# See how we were called. case "$1" instart)start;;stop)stop;;status)status -p ${pidfile} $httpdRETVAL=$?;;restart)stopstart;;condrestart|try-restart)if status -p ${pidfile} $httpd >&/dev/null; thenstopstartfi;;force-reload|reload)reload;;graceful|help|configtest|fullstatus)$apachectl $@RETVAL=$?;;*)echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"RETVAL=2 esacexit $RETVAL 添加服務(wù)并啟動httpd服務(wù)
  # cd /etc/rc.d/init.d# chkconfig --add httpd# vim /etc/profile.d/httpd.sh
     添加: export PATH=/usr/local/apache/bin:$PATH
  # ./etc/profile.d/httpd.sh

  # service httpd start

?

?

  

轉(zhuǎn)載于:https://www.cnblogs.com/ckh2014/p/10777961.html

總結(jié)

以上是生活随笔為你收集整理的LAMP(三)之CentOS6编译安装httpd2.4的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。