日期:2014-05-17 浏览次数:20792 次
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
?
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
?
?