操作系统:RHEL 6.5
相关软件包:百度网盘 密码:bty7
tar xzvf http-2.4.2.tar.gz -C /opt
tar xzvf apr-1.4.6.tar.gz -C /opt
tar xzvf apr-util-1.4.1.tar.gz -C /opt
cd /opt
cp -R apr-1.4.6 /opt/httpd-2.4.2/srclib/apr
cp -R apr-util-1.4.1 /opt/httpd-2.4.2/srclib/apr-util
yum install gcc gcc-c++ make pcre pcre-devel -y
cd /opt/httpd-2.4.2
4.1 配置
./configure \
--prefix=/usr/local/apache \
--enable-so \
--enable-rewrite \
--enable-mods-shared=most \
--with-mpm=worker \
--disable-cgid \
--disable-cgi
4.2 编译及安装
make && make install
grep -v "#" /usr/local/apache/bin/apachectl > /etc/init.d/httpd
vi /etc/init.d/httpd
#在文件最前面插入下面的行
#!/bin/sh
#chkconfig:2345 85 15
#description:Apache is a World Wide Web server.
chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 35 httpd on
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
vim /etc/httpd.conf
Listen:IP #监听IP地址,这里修改为自己的本地IP地址
ServerName:主机名.域名 #服务器名称
netstat -natp | grep 80
www站点目录为:/usr/local/apache/htdocs/
局域网中测试apache服务时请关闭防火墙
setenforce 0
service iptables stop
至此,Apache服务已经部署完毕,请见下一章部署Mysql服务。
原文地址:http://blog.51cto.com/10316297/2114681