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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

httpd编译安装

發布時間:2025/3/20 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 httpd编译安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

官網:http://httpd.apache.org/ ?

包:httpd-2.4.20.tar.bz2 ? ??

注釋:此處只考慮 2.4+ 的安裝與配置,基于CentOS 6 和 CentOS 7。 ?

??

(1)環境準備。 ?

? ? ~]# yum -y install gcc gcc-c++ apr-devel apr-util-devel pcre pcre-devel openssl openssl-devel ?

? ? ~]# tar -axf httpd-2.4.20.tar.bz2 ?

? ? ~]# cd httpd-2.4.20/ ?

??

(2)注意事項。 ?

? ? CentOS 6:注意事項 ?

? ? ? ? apr 與 apr-util 官網下載地址:http://apr.apache.org/download.cgi ?

? ? ? ? 版本要求: ?

? ? ? ? ? ? (1) apr ? ? ? ? ? ? version >= 1.4+ ?

? ? ? ? ? ? ? ? ~]# ./configure ?--prefix=/usr/local/apr ?

? ? ? ? ? ? ? ? ~]# make && make install ?

??

? ? ? ? ? ? (2) apr-util ? ? ? ?version >= 1.4+ ?

? ? ? ? ? ? ? ? ~]# ./configure ?--prefix=/usr/local/apr-util ?--with-apr=/usr/local/apr ?

? ? ? ? ? ? ? ? ~]# make && make install ?

??

(3)編譯安裝。 ?

? ? CentOS 6: ?

? ? ? ? ? ? ~]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=all --enable-mpms-shared=all --with-pcre --with-libxml2 --enable-cgi ?--with-mpm=prefork ?

? ? CentOS 7: ?

? ? ? ? ? ? ~]# ? ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-modules=all --enable-mpms-shared=all --with-pcre --with-libxml2 --enable-cgi ?--with-mpm=prefork ?

??

? ? ~]# make && make install ?

??

? ? 注釋: ?

? ? ? ? (1)--enable-mods-shared=all --enable-mods-static=all 只能選擇一個,選擇了 shared 之后還可以選擇部分 static。(非必選) ?

? ? ? ? (2) --enable-load-all-modules 開啟所有的選項,不要使用,開啟了所有的會存在一些沖突,當需要的時候手動開啟即可。 ?

? ? ? ? (2)--enable-cgi 為模塊。--with-pcre --with-libxml2 為擴展。(非必選) ?

? ? ? ? (3)--with-mpm=prefork 指定默認工作模型。(非必選) ?

? ? ? ? (4)--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util ?為 CentOS 6 系統的依賴。(CentOS 6 必選) ?

??

? ? 查看編譯了那些模塊: ?

? ? ? ? ? ? ~]# ls /usr/local/httpd/modules ?

??

? ? 查看加載了那些模塊: ?

? ? ? ? ? ? ~]# /usr/local/httpd/bin/httpd -M ?

=============================================== ?

常用選項解釋: ?

Configuration: ?

? ? -h, --help ? ? ? ? ? ? 顯示幫助文檔并退出 ?

??

Installation directories: ?

? --prefix=PREFIX ? ? ? ? 指定安裝路徑 ?

??

Fine tuning of the installation directories: ?

? ? --sysconfdir=DIR ? ? ? ?指定配置文件路徑 ?

??

Optional Features: ?

? --enable-load-all-modules ? ? 開啟所有的加載模塊 ?

? --enable-modules=MODULE-LIST ?開啟模塊 | "all" |"most" | "few" | "none" | "reallyall" ?

? --enable-mods-shared=MODULE-LIST ? ?共享模塊 |"all" | "most" | "few" | "reallyall" ?

? --enable-mods-static=MODULE-LIST ? 靜態模塊 |"all" | "most" | "few" | "reallyall" ?

? --enable-ssl ? ? ? ? ? ?SSL/TLS :構建 https ?

? --enable-mpms-shared=MPM-LIST ? ?共享模塊 | "all" ?

? --enable-rewrite ? ? ? ?url 重寫 ?

? --enable-vhost-alias ? ?虛擬主機 ?

? --enable-proxy-fcgi ? ? FastCGI 模塊 ?

? --enable-so ? ? ? ? ? ?允許運行時加載DSO模塊 ?

??

Optional Packages: ?

? ? --with-apr=PATH ? ? ? ? prefix for installed APR or the full path to apr-config ?

? ? --with-apr-util=PATH ? ?prefix for installed APU or the full path to ?apu-config ?

? ? --with-mpm=MPM ? ? ? ?指定apache默認工作模式:MPM={event|worker|prefork|winnt} ?

? ? --with-pcre=PATH ? ? ? ?perl語言兼容正則表達式)是一個用C語言編寫的正則表達式函數庫。 ?

? ? --with-libxml2=PATH ? ? Libxml2 是一個xml c語言版的解析器,還支持c++、PHP、Pascal、Ruby、Tcl等語言的綁定 ?

??

======================================================== ?

系統服務,啟動,庫,環境變量等設置。 ?

??

(1)測試是否正常。 ?

? ? ? ? 自帶啟動腳本: ?

? ? ? ? ? ? /usr/local/httpd/bin/apachectl (start | stop | restart | graceful | graceful-stop) ?

? ? ? ? 查看端口80是否被監聽: ?

? ? ? ? ? ? ss -tnl ?

??

(2)加入環境變量 ?

? ? 臨時生效: ?

? ? ? ? ~]# export PATH=/usr/local/httpd/bin:$PATH ?

??

? ? 永久生效: ?

? ? ? ? ~]# vim /etc/profile.d/httpd.sh ?

? ? ? ? ? ?export PATH=/usr/local/httpd/bin:$PATH ?

? ? ? ? ~]# source /etc/profile.d/httpd.sh ?

??

? ? 測試:(apachectl 現在是一個命令) ?

? ? ? ? ~]# apachectl (start | stop | restart | graceful | graceful-stop) ?

??

(3)導出庫文件: ?

? ? ? ? ~]# ln -s /usr/local/httpd/include /usr/include/httpd ?

??

(4)導出man手冊 ?

? ? CentOS 6: ?

? ? ? ? ~]# vim /etc/man.config ?

? ? CentOS 7: ?

? ? ? ? ~]# vi /etc/man_db.conf ?

??

? ? 寫入: ?

? ? ? ? MANPATH /usr/local/httpd/man ?

??

??

(5)服務腳本文件 ?

? ? CentOS 6:新加啟動腳本。 ?

~]# vi /etc/rc.d/init.d/httpd ?

-------------------------------------start---------------------------------------------- ?

#!/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/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/httpd/bin/apachectl ?

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

prog=httpd ?

pidfile=${PIDFILE-/usr/local/httpd/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 $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 "$1" 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 $@ ?

? ? RETVAL=$? ?

? ? ;; ?

? *) ?

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

? ? RETVAL=2 ?

esac ?

??

exit $RETVAL ?

---------------------------------------------------end------------------------------------------------ ?

??

??

CentOS 7 新加啟動腳本: ?

~]# vi ??

---------------------------------------------------start------------------------------------------------ ?

??

---------------------------------------------------end------------------------------------------------ ?

??

??

(6)開機啟動 ?

CentOS 6: ?

? ? ~]# chkconfig --add httpd ?

? ? ~]# chkconfig --level 345 httpd on ?

? ? ~]# chkconfig --list httpd ?

? ? ? ? httpd ? ? ? ? ?0:off ? 1:off ? 2:off ? 3:on ? ?4:on ? ?5:on ? ?6:off ?

??

CentOS 7: ?

? ? ??

??

(7)系統啟動與停止 ?

? ? CentOS 6: ?

? ? ? ? service httpd (start | stop | restart) ?

? ? CentOS 7: ?

? ? ? ? systemctl (start | stop | restart) httpd.service ?

??

(7)語法測試 ?

? ? httpd -t ?


轉載于:https://blog.51cto.com/echoroot/1948886

總結

以上是生活随笔為你收集整理的httpd编译安装的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 性色av浪潮 | 国产偷拍一区二区 | 亚洲av人人澡人人爽人人夜夜 | 色偷偷影院 | 亚洲激情视频在线观看 | 国产精品一线二线 | 亚洲另类春色 | 好屌妞视频这里只有精品 | 少妇久久精品 | 欧美性生活xxx | 中文字幕亚洲图片 | 成人激情在线视频 | 精品少妇v888av | 亚洲成人av片 | 日韩亚洲天堂 | 在线观看jizz | 九九在线免费视频 | 欧美女优视频 | 性视频网址 | 国产亚洲久一区二区 | 91娇羞白丝网站 | 中文国语毛片高清视频 | 久久亚洲精品视频 | av电影在线网站 | 视频一区二区三区精品 | 岛国精品在线 | 激情小说在线观看 | 91视频在线网站 | 性色av网站| 亚洲一级二级 | 亚洲男人在线天堂 | 免费成人在线视频观看 | 极品人妻videosss人妻 | 中文精品视频 | 色人阁网站 | 偷拍女澡堂一区二区三区 | 国产一级免费视频 | 星铁乱淫h侵犯h文 | 毛片a片免费观看 | 91资源站 | 日韩色小说 | 免费网站在线观看视频 | 国产一线二线在线观看 | 国产真实的和子乱拍在线观看 | 欧洲一二三区 | 激情综合五月天 | 国产aaaaaa| 美日韩成人av | 色婷婷18| 毛片视频免费播放 | 一区二区三区在线免费观看视频 | 久久久久人妻一区精品色 | 噜噜噜精品欧美成人 | 久久不卡 | 日日夜夜免费精品视频 | 久久av一区二区三区漫画 | 日韩免费视频观看 | 女人十八毛片嫩草av | 成人免费毛片色戒 | 大战熟女丰满人妻av | 国产精品久久久精品三级 | 欧美黄视频在线观看 | 在线精品免费视频 | 五十路在线 | 日本精品99| 久久视 | 日韩一区二区精品视频 | 成人av小说 | 姑娘第5集高清在线观看 | 国产一区二区三区在线视频观看 | 日本高清免费观看 | 精品国产一区二区三 | 精品一区二区免费视频 | 男女视频久久 | 色哟哟在线观看 | 欧美91视频 | 久久久一区二区三区 | 日韩久久久久久久久久 | 人体内射精一区二区三区 | 中文在线免费 | 国产精自产拍久久久久久蜜 | 欧美第三页 | 天天综合色 | 亚洲一二三四视频 | 日本一区二区视频在线观看 | 精品美女一区 | 欧美色图国产精品 | 欧洲亚洲天堂 | 国产3p精品一区 | 伊人伊人 | 日韩免费小视频 | 日韩av在线导航 | 狠狠躁夜夜躁人人爽天天高潮 | 国产精品资源在线观看 | 日本xxxx在线观看 | 黄色91视频 | proumb性欧美在线观看 | 日韩免费黄色片 | www.久久爱|