如何解决apache启动时错误:Could not reliably determine the server's fully qualified domain name

jerry ubuntu 2015年08月11日 收藏

启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name

[root@server httpd-2.2.4]# /usr/local/apache/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

1)进入apache的安装目录:(视个人安装情况而不同)

[root@server ~]# cd /usr/local/apache/conf

2)编辑httpd.conf文件,搜索"#ServerName",添加

ServerName localhost:80
[root@server conf]# ls
extra  httpd.conf  magic  mime.types  original
[root@server conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName localhost:80

3)再重新启动apache 即可。

[root@server ~]# /usr/local/apache/bin/apachectl restart