问题描述
我尝试在 CentOS 5.0 上重新启动我的 Apache 服务器并收到此消息:
I tried to restart my Apache server on CentOS 5.0 and got this message:
httpd:无法可靠地确定服务器的完全限定域名,使用 127.0.0.1 作为 ServerName
这是/etc/hosts
文件:
127.0.0.1 server4-245 server4-245.com localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
这是 /etc/sysconfig/network
文件:
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server4-245
我在 Apache httpd.conf 文件中也有这个:
I also have this in the Apache httpd.conf file:
ServerName localhost
但是,当我重新启动 Apache 时,我仍然收到第一条错误消息.
However, I still get the first error message when I restart Apache.
推荐答案
您的主机文件不包含有效的 FQDN,localhost
也不是 FQDN.FQDN 必须包含主机名部分和域名部分.例如,以下是有效的 FQDN:
Your hosts file does not include a valid FQDN, nor is localhost
an FQDN. An FQDN must include a hostname part, as well as a domain name part. For example, the following is a valid FQDN:
host.server4-245.com
选择一个 FQDN 并将其包含在您正在使用的 IPv4 和 IPv6 地址的 /etc/hosts
文件中(在您的情况下,localhost
或 >127.0.0.1
),并在 httpd 配置中更改您的 ServerName
以匹配.
Choose an FQDN and include it both in your /etc/hosts
file on both the IPv4 and IPv6 addresses you are using (in your case, localhost
or 127.0.0.1
), and change your ServerName
in your httpd configuration to match.
/etc/hosts:
/etc/hosts:
127.0.0.1 localhost.localdomain localhost host.server4-245.com
::1 localhost.localdomain localhost host.server4-245.com
httpd.conf:
httpd.conf:
ServerName host.server4-245.com
这篇关于httpd:无法可靠地确定服务器的完全限定域名,使用 127.0.0.1 作为 ServerName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!