首页 > 代码库 > 【apache http server安装】CentOS上编译安装Aapche Http Server详细过程

【apache http server安装】CentOS上编译安装Aapche Http Server详细过程

  1. 下载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

  1. 编译apache httpd

[root@centos1httpd-2.4.10]# ./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-utilprce后再编译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 

重启计算机后,防火墙默认已经开放了8022两个端口。

 

临时性的完全关闭防火墙,可以不重启机器:

#/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