CentOS7的鏡像中已經(jīng)提供了httpd2.4的rpm包,httpd2.4相對(duì)于httpd2.2有較大的改進(jìn),在CentOS6下只能通過(guò)Apache官方網(wǎng)站提供的源碼包編譯安裝。
十年的肅北網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開(kāi)發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營(yíng)銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整肅北建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“肅北網(wǎng)站設(shè)計(jì)”,“肅北網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。httpd2.4新特性:
MPM支持運(yùn)行DOS機(jī)制;
支持event MPM;
支持異步讀寫(xiě);
支持每模塊及每個(gè)目錄分別使用各自的日志級(jí)別;
每請(qǐng)求配置;<If>
增強(qiáng)版的表達(dá)式分析器;
支持毫秒級(jí)的keepalive timeout;
基于FQDN的虛擬主機(jī)不再需要NameVirtualHost指令;
支持用戶自定義變量;
新模塊:
mod_proxy_fcgi:與PHP結(jié)合的模塊;
mod_ratelimit:限制下載速率的模塊;
mod_remoteip:設(shè)定遠(yuǎn)程客戶端IP;
修改的配置機(jī)制:不再支持使用order,allow,deny定義基于ip的訪問(wèn)控制,改為require;
編譯安裝Httpd2.4:
httpd2.4依賴于apr和apr-util,1.4以上版本,所以需要一同編譯安裝;
apr:ApachePortable Runtime,Apache可移植運(yùn)行時(shí);
官網(wǎng):apr.apache.org
實(shí)驗(yàn)環(huán)境:
系統(tǒng)版本:CentOS 6.6x86_64;
httpd源碼包:httpd-2.4.16.tar.bz2;
apr源碼包:apr-1.5.2.tar.bz2;
apr-util源碼包:apr-util-1.5.4.tar.bz2
實(shí)驗(yàn)前提:
關(guān)閉防火墻和SELinux;
安裝編譯環(huán)境;
#yumgroupinstall"ServerPlatformDevelopment""Developmenttools"
實(shí)驗(yàn)過(guò)程:
一、安裝服務(wù);
apr:
#tarxfapr-1.5.2.tar.bz2 #cdapr-1.5.2 #./configure--prefix=/usr/local/apr #make&&makeinstall
apr-util:
#tarxfapr-util-1.5.4.tar.bz2 #cdapr-util-1.5.4 #./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/ --with-apr=/usr/local/apr/:指明apr安裝位置; #make&&makeinstall
httpd:
#tarxfhttpd-2.4.16.tar.bz2 #cdhttpd-2.4.16 #./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=all--enable-mpms-shared=all--with-mpm=event #make&&makeinstall
httpd編譯參數(shù)解釋:
--prefix=/usr/local/apache:安裝位置; --sysconfdir=/etc/httpd:配置文件位置; --enable-so:支持DSO動(dòng)態(tài)裝載模塊; --enable-ssl:支持SSL/TLS,可實(shí)現(xiàn)https協(xié)議訪問(wèn),需要安裝openssl-devel; --enable-cgi:支持CGI腳本; --enable-rewrite:支持URL重寫(xiě); --with-zlib:使用指定的zlib壓縮庫(kù),不指定路徑會(huì)自動(dòng)尋找; --with-pcre:使用指定的pcre庫(kù),增強(qiáng)的正則表達(dá)式分析工具;不指定路徑會(huì)自動(dòng)尋找需已安裝pcre-devel; --with-apr=/usr/local/apr:指定依賴apr程序安裝位置; --with-apr-util=/usr/local/apr-util:指定依賴apr-util程序安裝位置; --enable-modules=all:支持動(dòng)態(tài)啟用模塊;all:所有,most:常用; --enable-mpms-shared=all:編譯并共享模塊; --with-mpm=event:默認(rèn)啟用模塊;{prefork|worker|event}
二、參數(shù)配置;
接下來(lái)是安裝完成之后的參數(shù)配置;
添加環(huán)境變量,并重讀文件:
#vim/etc/profile.d/httpd.sh >exportPATH=/usr/local/apache/bin:$PATH #source/etc/profile.d/httpd.sh
導(dǎo)出頭文件;
#ln-sv/usr/local/apache/include/usr/include/httpd
導(dǎo)出man手冊(cè);
#vim/etc/man.config >MANPATH/usr/local/apache/man
啟動(dòng)服務(wù),查看監(jiān)聽(tīng)端口;
#apachectlstart #ss?tnl
訪問(wèn)測(cè)試;
提供服務(wù)腳本:
可使用rpm包安裝提供的腳本修改使用:
#vim/etc/rc.d/init.d/httpd >#!/bin/bash ># >#httpdStartupscriptfortheApacheHTTPServer ># >#chkconfig:-8515 >#description:ApacheisaWorldWideWebserver.Itisusedtoserve >#HTMLfilesandCGI. >#processname:httpd >#config:/etc/httpd/conf/httpd.conf >#config:/etc/sysconfig/httpd >#pidfile:/var/run/httpd.pid > >#Sourcefunctionlibrary. >./etc/rc.d/init.d/functions > >if[-f/etc/sysconfig/httpd];then >./etc/sysconfig/httpd >fi > >#StarthttpdintheClocalebydefault. >HTTPD_LANG=${HTTPD_LANG-"C"} > >#Thiswillpreventinitlogfromswallowingupapass-phrasepromptif >#mod_sslneedsapass-phrasefromtheuser. >INITLOG_ARGS="" > >#SetHTTPD=/usr/sbin/httpd.workerin/etc/sysconfig/httpdtouseaserver >#withthethread-based"worker"MPM;BEWARNEDthatsomemodulesmaynot >#workcorrectlywithathread-basedMPM;notablyPHPwillrefusetostart. > >#Pathtotheapachectlscript,serverbinary,andshort-formformessages. >apachectl=/usr/local/apache/bin/apachectl >httpd=${HTTPD-/usr/local/apache/bin/httpd} >prog=httpd >pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid} >lockfile=${LOCKFILE-/var/lock/subsys/httpd} >RETVAL=0 > >start(){ >echo-n$"Starting$prog:" >LANG=$HTTPD_LANGdaemon--pidfile=${pidfile}$httpd$OPTIONS >RETVAL=$? >echo >[$RETVAL=0]&&touch${lockfile} >return$RETVAL >} >stop(){ >echo-n$"Stopping$prog:" >killproc-p${pidfile}-d10$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$"notreloadingduetoconfigurationsyntaxerror" >failure$"notreloading$httpdduetoconfiguration>syntaxerror" >else >killproc-p${pidfile}$httpd-HUP >RETVAL=$? >fi >echo >} > >#Seehowwewerecalled. >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}" >exit1 >esac > >exit$RETVAL
修改主配置文件指定pidfile;
#vim/etc/httpd/httpd.conf >PidFile"/var/run/httpd.pid"
腳本執(zhí)行權(quán)限;
#chmod+x/etc/rc.d/init.d/httpd
添加服務(wù),測(cè)試腳本;
#chkconfighttpd?add #chkconfighttpdon
#servicehttpdstop #servicehttpdstart #servicehttpdrestart #servicehttpdreload
httpd2.4配置文件:
#/etc/httpd24:編譯安裝時(shí)指定的配置文件目錄; #/etc/httpd24/httpd.conf:主配置文件 #/etc/httpd24/extra/httpd-default.conf:默認(rèn)配置文件,keepalive、AccessFileName等設(shè)置; #/etc/httpd24/extra/httpd-userdir.conf:用戶目錄配置文件; #/etc/httpd24/extra/httpd-mpm.conf:MPM配置文件; #/etc/httpd24/extra/httpd-ssl.conf:SSL配置文件,為站點(diǎn)提供https協(xié)議; #/etc/httpd24/extra/httpd-vhosts.conf:虛擬主機(jī)配置文件; #/etc/httpd24/extra/httpd-info.conf:server-status頁(yè)面配置文件;
至此httpd2.4的編譯安裝配置已完成,httpd2.4的配置與httpd2.2大致相同。
本文出自 “小馬的學(xué)習(xí)記錄” 博客,請(qǐng)務(wù)必保留此出處http://masachencer.blog.51cto.com/8683770/1682809
網(wǎng)站名稱:Httpd2.4簡(jiǎn)介及CenOS6.6下編譯安裝
URL標(biāo)題:http://www.rwnh.cn/article30/cpespo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開(kāi)發(fā)、標(biāo)簽優(yōu)化、虛擬主機(jī)、網(wǎng)站改版、網(wǎng)站收錄、網(wǎng)站策劃
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)