[root@apache application]# /application/apache/bin/apachectl -l
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_dbm.c
mod_authn_anon.c
mod_authn_dbd.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_dbm.c
mod_authz_owner.c
....................................................
7:启动APACHE并测试
[root@apache application]# /application/apache/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.17.16 for ServerName
#第一次启动时,此提示可暂时忽略
查看80端口:
[root@apache application]# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 58925 root 4u IPv6 50990 0t0 TCP *:http (LISTEN)
httpd 58927 daemon 4u IPv6 50990 0t0 TCP *:http (LISTEN)
httpd 58928 daemon 4u IPv6 50990 0t0 TCP *:http (LISTEN)
httpd 58929 daemon 4u IPv6 50990 0t0 TCP *:http (LISTEN)
查看httpd进程:
[root@apache application]# ps -ef|grep httpd
root 58925 1 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58926 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58927 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58928 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58929 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
APACHE启动成功后,在浏览器输入该服务器IP地址,可看到It works!字样:
[root@apache application]# ifconfig eth0|awk -F '[ :]+' 'NR==2{print $4}'
192.168.17.16
如果出不来it works的内容页面,请从下面原因中依次排查:
1:iptables防火墙和selinux是否关闭
[root@apache application]# /etc/init.d/iptables stop
#这是关闭防火墙的命令,如果是生产环境请允许80端口的访问,而不是关闭防火墙
#允许命令如下:
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
关闭selinux:
临时关闭:setenforce 0
永久关闭(修改配置文件):cat /etc/selinux/config|grep SELINUX=disabled
2:通过下面命令确认httpd端口80是否存在
[root@apache application]# netstat -lnput|grep 80
tcp 0 0 :::80 :::* LISTEN 58925/httpd
3:查看是否有httpd进程存在
[root@apache application]# ps -ef|grep http
root 58925 1 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58926 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58927 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58928 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 58929 58925 0 10:32 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
daemon 59016 58925 0 10:34 ? 00:00:00 /application/apache2.2.31/bin/httpd -k start
4:在服务器本地wget 测试
注意:如果前面第2步和第3步都不符合要求,这步就不用查了,一定不行,直接下一步检查
这里把服务器本地当作客户端模拟用户检查http服务,此条的检查比第2步第3步的检查会更准确。同时可以排除防火墙的干扰来检查http服务,如果正常访问,说明apache服务没问题,那么就是网络或防火墙等问题了。
5:查看apache的错误日志看看是否有特殊异常
如果以上5条全都注意到了,基本问题就可以解决,如果是2,3步异常,则可以查看apache错误日志,获取信息
[root@apache application]# tail -10 /application/apache/logs/error_log
APACHE的默认站点目录,是安装目录下的/apache/htdocs,这可以从APACHE主配置文件/application/apache/conf/httpd.conf中可以查到: