標籤:linux apache
apache 的編譯安裝 650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/57/5D/wKioL1SZAZHyTVxJAACovhiKll8836.jpg" title="11.png" alt="wKioL1SZAZHyTVxJAACovhiKll8836.jpg" />
首先對壓縮包解壓,靜茹檔案夾
[[email protected] software]# ll
total 7036
drwxr-xr-x. 11 dwchaoyue dwchaoyue 4096 Jan 25 2012 httpd-2.2.22
-rw-r--r--. 1 root root 7200529 Dec 22 21:13 httpd-2.2.22.tar.gz
[[email protected] software]# cd httpd-2.2.22
[[email protected] httpd-2.2.22]#
apache 的安裝分為以下幾個步驟。
-
[email protected] httpd-2.2.22]#./configure --prefix=/usr/local/apache --enable-so --enable- proxy --enable-proxy-http --enable-proxy-balancer --enable-modules=all --enable-mods- shared=all
-
執行make
-
執行make install
-
chkconfig --add httpd # 添加到系統服務
-
chkconfig --level 345 httpd on
查看apache服務狀態
[[email protected] httpd-2.2.22]# service httpd status
httpd (pid 10175) is running...
[[email protected] httpd-2.2.22]#
apache服務成功安裝!
配置apache服務.
尋找apache的設定檔
[[email protected] httpd-2.2.22]# updatedb
[[email protected] httpd-2.2.22]# locate httpd.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.confbak
/home/software/httpd-2.2.22/docs/conf/httpd.conf.in
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/original/httpd.conf
[[email protected] httpd-2.2.22]#
/etc/httpd/conf/httpd.conf 即為apache的設定檔.
修改/etc/httpd/conf/httpd.conf 檔案
[[email protected] httpd-2.2.22]# vi /etc/httpd/conf/httpd.conf
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/apache"
將 DocumentRoot修改為 DocumentRoot "/usr/local/apache/htdocs"
在客服端測試,直接在瀏覽器中輸入http://ip
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/57/60/wKiom1SZBVSSchBBAAC3AJY6jHg562.jpg" title="22.jpg" alt="wKiom1SZBVSSchBBAAC3AJY6jHg562.jpg" />
apache 搭建完成,並且能正確瀏覽內建頁面.
異常處理:
執行./configure --prefix=/usr/local/apache --enable-so 報錯》
[[email protected] httpd-2.2.22]#./configure --prefix=/usr/local/apache --enable-so --enable-proxy --enable-proxy-http --enable-proxy-balancer --enable-modules=all --enable-mods-shared=all
checking whether to enable mod_charset_lite... no
checking whether to enable mod_deflate... checking dependencies
checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
解決方案: 安裝zlib-devel
[[email protected] Packages]# ll | grep -i zlib-devel
-r--r--r--. 211 root root 44740 Sep 26 2011 zlib-devel-1.2.3-27.el6.i686.rpm
-r--r--r--. 131 root root 44728 Sep 26 2011 zlib-devel-1.2.3-27.el6.x86_64.rpm
[[email protected] Packages]# rpm -ivh zlib-devel-1.2.3-27.el6.x86_64.rpm
warning: zlib-devel-1.2.3-27.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:zlib-devel ########################################### [100%]
參考連結:
http://www.jb51.net/LINUXjishu/39765.html
http://blog.sina.com.cn/s/blog_53cb817c01011a3o.html
http://www.linuxidc.com/Linux/2012-07/66029.htm
apache的配置:
http://wenku.baidu.com/view/6781e29951e79b89680226f2.html
本文出自 “SQLServer MySQL” 部落格,請務必保留此出處http://dwchaoyue.blog.51cto.com/2826417/1593808
apache 的編譯安裝