標籤:安裝 伺服器 apache
1.下載apache www.apache.org 找到相應的地址複製後 weget即可,也可以用下面這個
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.23.tar.gztar -xf httpd-2.4.23.tar.gz./configure --prefix=/application/apache2.4.23--enable-deflate --enable-expires--enable-header --enable-modules=most --enable-rewrite--enable-so--with-mpm=worker
解釋一下上面的參數:
--prefix 安裝路徑
--enable-modules=most 使用大部分常用模組
--enable-rewrite 重寫模組
--with-mpm=work 運行方式為一個主進程若干個子線程,還可以配置為進程,配置為進程的優點是更穩定,但是同時也更慢,更耗費cpu資源,當前主流都是把apache作為靜態伺服器使用所以使用work就可以了。如果你要和php等程式做配合可以設定為進程方式工作。
2.進行到這一步的時候出現了錯誤提示找不到apr,逐回到apache.org下載 apr和apr-util
wget http://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz./configure --prefix=/application/aprmakemake installwget http://mirrors.cnnic.cn/apache/apr/apr-util-1.5.4.tar.gz ./configure --prefix=/application/apr-util --with-apr=/application/aprmakemake install
3.重新安裝apache,進入apache解壓縮目錄
./configure --prefix=/application/apache2.4.23--enable-deflate --enable-expires--enable-header --enable-modules=most --enable-rewrite--enable-so--with-mpm=worker--with-apr=/application/apr --with-apr-util=/application/apr-util
4.繼續報錯
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
這是因為沒有安裝zlib包,逐 yum 安裝之
yum install zlib-devel
5.ok 裝好後繼續 make apache 這次沒有問題了 繼續 make install 至此安裝完畢
6.修改/application/apache2.4.23/conf/httpd.conf
找到#ServerName去掉# 更改為: ServerName localhost:80
7.啟動apache
/application/apache2.4.23/bin/httpd -k start
8.測試一下
curl 本機ip 如果 返回 it works 證明apache已經可以正常運行了
本文出自 “12131629” 部落格,請務必保留此出處http://12141629.blog.51cto.com/12131629/1881734
centos6.5下Apache 安裝