如何安裝apache并使工作模式為work?這個(gè)問題可能是我們?nèi)粘9ぷ鹘?jīng)常見到的。通過這個(gè)問題,希望你能收獲更多。下面是解決這個(gè)問題的步驟內(nèi)容。
一、apache模式的查看
如果apache已經(jīng)安裝,我們可以用 httpd -l 命令查看當(dāng)前模式(只可能有一種),如果找到 prefork.c 則表示當(dāng)前工作在prefork模式,同理出現(xiàn)worker.c則工作在worker模式。
如果apache還未安裝,我們在編譯的時(shí)候可以加入--with-pem=(prefork|worker)
選項(xiàng)決定啟用什么模式。
當(dāng)然如果你安裝過了(筆者模式為prefork) 也可以使用以下命令來切換
mv httpd httpd.prefork
mv httpd.worker httpd
重啟之后,模式就會改變。
二、安裝apche
由于Apache依賴于APR、APR-Util和PCRE,所以需要下載:
APR + APR-Util:http://apr.apache.org/download.cgi
PCRE:http://sourceforge.net/projects/pcre/files/pcre/
1、安裝 apr
tar zxvf apr-1.5.1.tar.gz (解壓文件到目錄/home/gaoqing/software/apache下)
./configure--prefix=/home/gaoqing/software/apache/apr 配置安裝目錄
make
make install
2、安裝apr-util
./configure--prefix=/home/gaoqing/software/apache/apr-util --with-apr=/home/gaoqing/software/apache/apr
make && make install
3、安裝 pcre
./configure --prefix=/home/gaoqing/software/apache/pcre
4、安裝apache,并指定工作模式為work
下載地址:http://httpd.apache.org/
./configure --prefix=/home/gaoqing/software/apache/apache --with-apr=/home/gaoqing/software/apache/apr --with-apr-util=/home/gaoqing/software/apache/apr-util --with-pcre=/home/gaoqing/software/apache/pcre --with-mpm=worker
make && make install
三、配置
修改配置文件,否則會出現(xiàn)問題:
AH00558: httpd: Could notreliably determine the server's fully qualified domain name, using 127.0.1.1.Set the 'ServerName' directive globally to suppress this message
解決方法:修改conf/httpd.conf 把:
# ServerNamewww.example.com:80
改為:
ServerNamelocalhost:80
四:apache服務(wù)的啟動(dòng)、停止、重啟
假設(shè)你的apahce安裝目錄為/usr/local/apache2,這些方法適合任何情況
apahce啟動(dòng)命令:
推薦/usr/local/apache2/bin/apachectl start apaceh啟動(dòng)
apache停止命令
/usr/local/apache2/bin/apachectl stop 停止
apache重新啟動(dòng)命令:
/usr/local/apache2/bin/apachectl restart 重啟
要在重啟 Apache 服務(wù)器時(shí)不中斷當(dāng)前的連接,則應(yīng)運(yùn)行:
/usr/local/sbin/apachectl graceful
service httpd start 啟動(dòng)
service httpd restart 重新啟動(dòng)
servicehttpd stop 停止服務(wù)
關(guān)于編譯安裝apache的知識就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果喜歡這篇文章,不如把它分享出去讓更多的人看到。
當(dāng)前標(biāo)題:如何安裝apache并使工作模式為work-創(chuàng)新互聯(lián)
鏈接分享:http://aaarwkj.com/article48/gighp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、網(wǎng)站營銷、全網(wǎng)營銷推廣、網(wǎng)站策劃、網(wǎng)頁設(shè)計(jì)公司、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容