Centos安装Apache启动错误:
Apache启动错误:httpd.exe: Could not reliably determine the server‘s fully qualified
在自己电脑配置Apache开发环境问题的时候,可能会遇到apache的启动错误:httpd.exe: Could not reliably determine the server‘s fully qualified domain name, using 192.168. x. x for ServerName,这个错误在error.log也会有输出。
# 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.
#
#ServerName www.xizhilang.com:8080
# 在httpd.conf文件中添加下面这行,就能避免这个启动错误
ServerName localhost:8080
正如注释推荐的做法,直接将本机的名称指定为你的IP地址,而报出的那个错误就是因为未配置域名服务器或者域名服务器未能找到该域名的地址。把Apache服务的名称指定为本地IP地址,就不需要去通过DNS服务器去得到本机的IP地址,而localhost这个特殊的地址是由DNS自己本身实现的一个内置配置,所以这里用localhost也可以在本地完成地址的转换。
我试着修改本地的hosts文件和httpd.conf文件,也能避免那个错误的出现,具体方法如下。
首先,修改httpd.conf文件,在配置文件中添加该项配置 ServerName xizhilang.com:8080 ,即上面的那个配置。
# 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.
#
#ServerName www.xizhilang.com:8080
ServerName xizhilang.com:8080
然后,修改hosts文件,hosts文件的位置是 “系统盘符:\Windows\System32\drivers\etc\hosts” ,打开之后在最后添加两行,配置如下:
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
# 添加如下两行,将 xizhilang.com 域名解析成本地地址
127.0.0.1 xizhilang.com
::1 xizhilang.com
添加完后,打开apache之后,OK搞定,警告信息不再出现!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。