WenRou's Blog

新浪微薄腾讯微薄

最新碎语:测试图片碎语哦

您的位置:WenRou's Blog >lnamp> httpd服务无法启动 /bin/systemctl start httpd.service

httpd服务无法启动 /bin/systemctl start httpd.service

[root@austgl gl]# service httpd start
Redirecting to /bin/systemctl start httpd.service
Job for httpd.service failed. See ‘systemctl status httpd.service’ and ‘journalctl -xn’ for details.
[root@austgl gl]# systemctl status httpd.service
httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: failed (Result: exit-code) since 六 2013-07-27 02:53:04 CST; 20s ago
Process: 5466 ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop (code=exited, status=0/SUCCESS)
Process: 5463 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)

7月 27 02:53:04 austgl.com systemd[1]: Starting The Apache HTTP Server…
7月 27 02:53:04 austgl.com httpd[5463]: AH00557: httpd: apr_sockaddr_info_get() failed for austgl.com
7月 27 02:53:04 austgl.com httpd[5463]: AH00558: httpd: Could not reliably determine the server’s fully qualified do…essage
7月 27 02:53:04 austgl.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
7月 27 02:53:04 austgl.com httpd[5466]: AH00557: httpd: apr_sockaddr_info_get() failed for austgl.com
7月 27 02:53:04 austgl.com httpd[5466]: AH00558: httpd: Could not reliably determine the server’s fully qualified do…essage
7月 27 02:53:04 austgl.com httpd[5466]: httpd (no pid file) not running
7月 27 02:53:04 austgl.com systemd[1]: Failed to start The Apache HTTP Server.
7月 27 02:53:04 austgl.com systemd[1]: Unit httpd.service entered failed state.
[root@austgl gl]#
[root@austgl gl]# /usr/sbin/httpd $OPTIONS -DFOREGROUND
AH00557: httpd: apr_sockaddr_info_get() failed for austgl.com
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1. Set the ‘ServerName’ directive globally to suppress this message
[root@austgl gl]#

解决方法
先查看hostname
[root@austgl sysconfig]# hostname
austgl.com

将hostname加入host文件即可

[root@austgl sysconfig]# vi /etc/host

127.0.0.1 austgl.com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
~
[root@austgl sysconfig]# /usr/sbin/httpd $OPTIONS -DFOREGROUND

在打开localhost

OK了
上述命令开启的服务在Ctrl+C或关闭终端后就停止了服务 请用

[root@austgl sysconfig]# /usr/sbin/httpd $OPTIONS -DFOREGROUND
^C^C[root@austgl sysconfiservice httpd start
Redirecting to /bin/systemctl start httpd.service
[root@austgl sysconfig]#


注:

systemctl enable httpd.service 
将httpd服务设为开机自动启动

systemctl disable httpd.service
禁止httpd服务开机自动启动

systemctl status httpd.service 
查看httpd服务的运行状态

//Loaded行中的enabled表示该服务是开机自动启动的,disable表示该服务不是开机自动启动的

systemctl is-active httpd.service
检查httpd服务是否处于活动状态

systemctl start httpd.service
启动httpd服务

systemctl stop httpd.service
停止httpd服务

systemctl restart httpd.service 
重新启动httpd服务

---

转载请注明本文标题和链接:《httpd服务无法启动 /bin/systemctl start httpd.service

发表评论

82 + 1 =
路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交