Apache启动时报Could not reliably determine the server's fully qualified domain name
在系统启动时apache,没有启动起来,查看“事件查看器”发现报一些错误:
The Apache service named reported the following error:
>>> httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.0.200 for ServerName
回头,查看apache日志logs/error.log,发现报的是类似的错误。
都是说Could not reliably determine the server's fully qualified domain name。
我先分析了下,似乎是apache启动时可能会查询DNS来验证ServerName的配置。可是我用的是私有IP的,这怎么配置?
抱着疑问的态度,我又查看 httpd.conf 文件,查找关于ServerName配置的片段,我忽然发现,人家已经在注释中把这个问题说的很详细,可是我在开始的配置中却忽视了他。
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerNamewww.web8cn.com:80
所以嘛,你如果是在本地电脑上开发,可以这样写:
ServerName 127.0.0.1:80
重新启动apache查看日志无再报错,问题解决了。
这是我又回过头好好想想我安装apache时的步骤。
我发现开始安装的时候,如果它会让你填写类似 域名和主机名的信息。
如果你是正式部署可以写正确的域名,如果只是开发用的是私有IP的话可以写自己的私有IP。