日期:2014-05-16  浏览次数:21001 次

安装配置Apache
安装包的获取:http://www.apache.org
1.1.安装Apache(tar包)
tar –zxvf http-2.2.11.tar.gz
cd http-2.2.11
./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
make && make install
1.2.配置Apache
vi /usr/local/apache/conf/httpd.conf
找到下面这行
#ServerName www.example.com:80
修改为:
ServerName www.dong.com:80
保存退出。
1.3.拷贝文件
cp –a /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
cp –a /usr/local/apache/bin/apachectl /etc/httpd/conf/httpd
将httpd加到系统服务中
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
vi httpd //在/etc/rc.d/int.d/目录下编辑复制过去的httpd程序
找到:#!/bin/sh //一般在第一行
另起一行,增加:
# chkconfig: 2345 70 30
# description: Apache
然后注册服务:chkconfig --add httpd
启动:service httpd start
停止:service httpd stop
重新启动:service httpd restart
重启apache
如果失败,把占用80的程序灭了
netstat -lnp|grep 80

1.4运行service命令
Service httpd restart
1.5检验配置是否成功
IE地址栏输入:http://www.dong.com
看到It’s Work证明配置成功。
或者使用 ps –aux|grep httpd
如果看到多行数据,也证明配置成功