標籤:apache http server 安裝
下載apache httpd
# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.10.tar.gz
2. 解壓 apache httpd
# tar xzvf httpd-2.4.10.tar.gz
編譯apache httpd
[[email protected]]# ./configure
checkingfor chosen layout... Apache
checkingfor working mkdir -p... yes
checkingfor grep that handles long lines and -e... /bin/grep
checkingfor egrep... /bin/grep -E
checkingbuild system type... i686-pc-linux-gnu
checkinghost system type... i686-pc-linux-gnu
checkingtarget system type... i686-pc-linux-gnu
configure:
configure:Configuring Apache Portable Runtime library...
configure:
checkingfor APR... no
configure:error: APR not found. Please read thedocumentation.
說明需要先安裝apr, apr-util和prce後再編譯httpd
3. 安裝apr
# wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.1.tar.gz
# wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.3.tar.gz
#tar xzvf apr-1.5.1.tar.gz
#cd apr-1.5.1.tar.gz
# ./configure--prefix=/usr/local/apr
#make
#make install
安裝apr-util
#tar xzvf apr-util-1.5.3.tar.gz
#cd apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config
#make
#make install
4. 安裝c++編譯器
# yum -y install gcc
# yum -y install gcc-c++
5. 安裝prce
#wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.35%2F&ts=1407339176&use_mirror=jaist
# tar xzvf pcre-8.35.tar.gz
#cd pcre-8.35
#./configure --prefix=/usr/local/pcre
#make & make install
6. 編譯httpd
# ./configure --prefix=/usr/local/apache2--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
#make & make install
7. 將80連接埠在防火牆上關閉或者關閉防火牆
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
#/etc/rc.d/init.d/iptables save
重啟電腦後,防火牆預設已經開放了80和22兩個連接埠。
臨時性的完全關閉防火牆,可以不重啟機器:
#/etc/init.d/iptables status ##查看防火牆狀態
#/etc/init.d/iptable stop ## 本次關閉防火牆
#/etc/init.d/iptable restart ## 重啟防火牆
或者永久性關閉防火牆:
#chkconfig --level 35 iptables off ## 注意中間的是兩個英式小短線;重啟
8. 啟動apache httpd
/usr/local/apache2/bin/apachectl
9. 在瀏覽器中輸入:http://192.168.146.128/ 顯示It works 頁面則表示apachehttp server安裝成功了!
本文出自 “開普技術” 部落格,請務必保留此出處http://kypulo.blog.51cto.com/9227739/1536675