http://hi.baidu.com/maclinuxp/item/28d8b62828ee1d88af48f585
https://bugzilla.redhat.com/show_bug.cgi?id=730832
http://forums.fedoraforum.org/showthread.php?t=272154
[root@localhost ~]# service httpd start
Starting httpd (via systemctl): Job failed. See system logs and 'systemctl status' for details.
[FAILED]
[root@localhost ~]# systemctl --failed
UNIT LOAD ACTIVE SUB JOB DESCRIPTION
httpd.service loaded failed failed The Apache HTTP Server (prefork MPM)
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
JOB = Pending job for the unit.
1 units listed. Pass --all to see inactive units, too.
[root@localhost ~]# systemctl status httpd.service
問題描訴:
service httpd start
Starting httpd (via systemctl): Job failed. See system logs and 'systemctl status' for details.
這里有兩個文件可以查看
1./var/log/httpd/error-log
基本沒收獲,這個問題根本沒有寫這個文件
2./var/log/messages
這個文件基本所有程序都會向里面寫東西,我先清空該文件,方便我們觀察錯誤
echo "" >/var/log/messages
然后執行 service httpd start
當然肯定錯誤還是有,這個時候我們在查看message文件
[root@localhost log]# more messages
Feb 18 21:06:31 localhost kernel: [13315.945323] intel ips 0000:00:1f.6: MCP lim
it exceeded: Avg temp 9279, limit 9000
Feb 18 21:06:34 localhost httpd[15298]: httpd: Could not reliably determine the
server's fully qualified domain name, using localhost.localdomain for ServerName
Feb 18 21:06:34 localhost httpd[15298]: (98)Address already in use: make_sock: c
ould not bind to address [::]:443
Feb 18 21:06:34 localhost httpd[15298]: (98)Address already in use: make_sock: c
ould not bind to address 0.0.0.0:443
Feb 18 21:06:34 localhost httpd[15298]: no listening sockets available, shutting
down
==============
可以看出 我們電腦的443端口被其他程序占用了
我們來查看該端口到底運行的什么程序----------
[root@localhost log]# lsof -i:443
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
hostd-wor 1722 root 28u IPv4 23805 0t0 TCP *:https (LISTEN)
hostd-wor 1722 root 29u IPv6 23806 0t0 TCP *:https (LISTEN)
好了,看得出 是 hostd-wor 命令 占用了改端口。果斷殺之
[root@localhost log]# kill 1722
然后在啟動試試
[root@localhost log]# service httpd start
Starting httpd (via systemctl): [確定]
=============
看樣子是成功了。。。。。。。。。。。。
然后我們改變一下端口試試,httpd 默認的監聽端口是 80,我改為 9999
這是因為 9999端口被selinx 禁止了
我們添加上
semanage port -a -t http_port_t -p tcp 9999
然后在啟動就行了