(三)apache安装
1.下载
下载地址:http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.21.tar.gz
?
卸载
查看是否系统已安装过apache
[root@localhost httpd-2.2.21]# rpm -qa|grep httpd?
centOS5.4 默认自带apache卸载掉
[root@localhost httpd-2.2.21]# rpm -e httpd --nodeps?
?
2.安装
????? 解压
[root@localhost httpd-2.2.21]# tar -zxvf httpd-2.2.21.tar.gz
?
??? 进入解压目录
[root@localhost bluesea]# cd httpd-2.2.21
?
??? 配置安装参数
?
./configure --prefix=/usr/local/apache --enable-so?
??? 编译
[root@localhost httpd-2.2.21]# make
?
??? 安装
[root@localhost httpd-2.2.21]# make install
?
??? 修改配置
[root@localhost httpd-2.2.21]# cd /usr/local/apache/conf/[root@localhost conf]# vi httpd.conf
??? 修改并保存退出(:wq)
??? Listen 80改成Listen 192.168.8.12:80
?
??? 测试:输入http://192.168.8.12 显示?? It works!
?
??? 解决局域其他机器网无法访问问题
???? 方案1
???/etc/init.d/iptables stop??? #start 开启???#restart 重启???永久性关闭防火墙chkconfig –level 35 iptables off??? ???? 方案2???? 修改vi /etc/sysconfig/iptables命令添加使防火墙开放80端口?
3.注册为服务
?? 拷贝apache启动脚本
[root@localhost bin]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
?? 编辑apache启动脚本
[root@localhost bin]# vi /etc/init.d/httpd
?
???? 修改并退出(:wq)
???? 在#!/bin/sh下面加上
???? #chkconfig:345 85 15
????#description:start and stops the apache http server.
?
?? 添加到服务
[root@localhost bin]# chkconfig --add httpd
?? 测试 输入service httpd start/stop/restart
?
4.开机启动
?命令加入到rc.local里面
?echo /usr/local/apache/bin/apachectl >> /etc/rc.d/rc.local
?
?