无法可靠地确定服务器的完全限定域名

发布于 11-04 17:25 字数 273 浏览 6 评论 0原文

我刚刚安装了 Apache 2.2.17,这是我第一次使用它。

现在,当我尝试使用命令 service httpd start 启动服务器时,它会显示以下消息:

httpd:无法可靠地确定服务器的完全限定域名,使用 ::1 作为 ServerName

现在我想我必须在通过 Google 搜索时设置 ServerName 和 IP 地址。但我不知道我必须在哪个文件中设置。

我该如何解决这个问题?

I have just installed Apache 2.2.17, and I am using it for the first time.

Now when I try to start the server using the command service httpd start it gives me the message:

httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName

Now I think I have to set ServerName and the IP address as I search through Google. But I don't know in which file I have to set.

How can I fix this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(16

暖树树初阳… 2024-11-11 17:25:45
  1. sudo vim /etc/apache2/httpd.conf
  2. 在 httpd.conf 中插入以下行: ServerName localhost
  3. 只需重新启动 Apache: sudo /etc/init.d 即可。 d/apache2 重新启动
  1. sudo vim /etc/apache2/httpd.conf
  2. Insert the following line at the httpd.conf: ServerName localhost
  3. Just restart the Apache: sudo /etc/init.d/apache2 restart
初熏 2024-11-11 17:25:45

是的,您应该设置 ServerName:

http://wiki.apache.org/httpd/CouldNotDetermineServerName

http://httpd.apache.org/docs/current/mod/core.html#servername

可以找到有关各种使用的布局的信息httpd 发行版在这里:

http://wiki.apache.org/httpd/DistrosDefaultLayout

在您的情况下,要编辑的文件是 /等/httpd/conf/httpd.conf

Yes, you should set ServerName:

http://wiki.apache.org/httpd/CouldNotDetermineServerName

http://httpd.apache.org/docs/current/mod/core.html#servername

You can find information on the layouts used by the various httpd distributions here:

http://wiki.apache.org/httpd/DistrosDefaultLayout

In your case the file to edit is /etc/httpd/conf/httpd.conf

牵你手 2024-11-11 17:25:45

我没有弄错服务器名称。在导致此警告消息的 VirtualHost 配置中,它是 httpd.conf 顶部附近的通用配置,默认情况下注释

更改

#ServerName www.example.com:80

为:

  ServerName 127.0.0.1:80

I was NOT getting the ServerName wrong. Inside your VirtualHost configuration that is causing this warning message, it is the generic one near the top of your httpd.conf which is by default commented out.

Change

#ServerName www.example.com:80

to:

  ServerName 127.0.0.1:80
骷髅 2024-11-11 17:25:45

在 Debian Squeeze 下;

  1. 编辑 Apache2 conf 文件: vim /etc/apache2/apache2.conf
  2. 在 apache2.conf 中插入以下行: ServerName localhost
  3. 重新启动 Apache2: apa​​che2ctl restart 或 /etc/init.d/apache2 restart

应该可以正常工作(它确实解决了问题就我而言)

tks noodl 不同布局上的链接。 :)

Under Debian Squeeze;

  1. Edit Apache2 conf file : vim /etc/apache2/apache2.conf
  2. Insert the following line at the apache2.conf: ServerName localhost
  3. Restart Apache2: apache2ctl restart or /etc/init.d/apache2 restart

Should work fine (it did solve the problem in my case)

tks noodl for the link on the different layouts. :)

世态炎凉 2024-11-11 17:25:45
  1. sudo nano /etc/apache2/httpd.conf
  2. 在 nano 编辑器中搜索文本 ServerName
  3. 在以下位置插入以下行httpd.conf:ServerName localhost
  4. 只需重新启动 Apache:sudo /usr/sbin/apachectl restart
  1. sudo nano /etc/apache2/httpd.conf
  2. search for a text ServerName in nano editor <Ctrl + W>
  3. Insert the following line at the httpd.conf: ServerName localhost
  4. Just restart the Apache: sudo /usr/sbin/apachectl restart
雨的味道风的声音 2024-11-11 17:25:45

" 要解决这个问题,需要设置ServerName。

1: $ vim /etc/apache2/conf.d/name
例如设置添加 ServerName localhost 或任何其他名称:

2: ServerName localhost
重新启动 Apache 2

3:$ service apache restart
在本示例中,我使用 Ubuntu 11.10.1.125"

" To solve this problem You need set ServerName.

1: $ vim /etc/apache2/conf.d/name
For example set add ServerName localhost or any other name:

2: ServerName localhost
Restart Apache 2

3: $ service apache restart
For this example I use Ubuntu 11.10.1.125"

我还不会笑 2024-11-11 17:25:45

另一种选择是确保完全限定主机名 (FQDN) 列在 /etc/hosts 中。
这对我在 Ubuntu v11.10 上有效,无需更改默认的 Apache 配置。

Another option is to ensure that the full qualified host name (FQDN) is listed in /etc/hosts.
This worked for me on Ubuntu v11.10 without having to change the default Apache configuration.

假扮的天使 2024-11-11 17:25:45

FQDN 表示通过 DNS 解析的名称。它应该类似于“服务器名称.搜索域”。

您收到的警告只是通知 httpd 无法找到 FQDN,因此它可能无法正常处理基于名称的虚拟主机。因此,请确保在您的 DNS 服务器中注册了预期的 FQDN,或者在点击 DNS 之前在 /etc/hosts 中手动添加条目。

FQDN means the resolved name over DNS. It should be like "server-name.search-domain".

The warning you get just provides a notice that httpd can not find a FQDN, so it might not work right to handle a name-based virtual host. So make sure the expected FQDN is registered in your DNS server, or manually add the entry in /etc/hosts which is prior to hitting DNS.

爱的十字路口 2024-11-11 17:25:45

如果您使用的是 Windows,则会出现不同的情况,

首先打开 c:/apache24/conf/httpd.conf
Apache 文件夹就足够了,不需要特别指定上面的路径

,之后您必须配置 httpd.conf 文件。

几行之后,出现如下模式:

#Listen _____________:80
Listen 80

Here You have to change for the localhost

您必须输入 ipv4 地址才能打开 localhost。

请参阅此视频链接,然后再了解更多内容。

更改您的环境变量:

系统设置中的环境用户变量的图像

您必须在其中输入路径:

c:apache24/bin


系统变量中相同

图像用于系统变量路径

如果有任何疑问,请随时询问。

If you are using windows there is something different sort of situation

First open c:/apache24/conf/httpd.conf.
The Apache folder is enough not specifically above path

After that you have to configure httpd.conf file.

Just after few lines there is pattern like:

#Listen _____________:80
Listen 80

Here You have to change for the localhost.

You have to enter ipv4 address for that you can open localhost.

Refer this video link and after that just bit more.

Change your environment variables:

Image for Environment USER Variables in System setting

In which you have to enter path:

c:apache24/bin

and
same in the SYSTEM variables

Image is for system variables path

If any query feel free to ask.

看春风乍起 2024-11-11 17:25:45

有两件事似乎对我有用:

  1. 将 /etc/hosts 中 127.0.0.1 的所有别名放在一行中(例如 127.0.0.1 localhost mysite.local myothersite.local
  2. Set ServerName< /code> 在我的 httpd.conf 中改为 0.0.0.0 (localhost 或 127.0.0.1 对我来说不起作用)

编辑 /etc/hosts 摆脱了长响应时间并设置 ServerName 摆脱了OP对我的警告。

Two things seemed to do it for me:

  1. Put all aliases for 127.0.0.1 in /etc/hosts in a single line (e.g. 127.0.0.1 localhost mysite.local myothersite.local
  2. Set ServerName in my httpd.conf to 0.0.0.0 (localhost or 127.0.0.1 didn't work for me)

Editing /etc/hosts got rid of long response times and setting the ServerName got rid of OP's warning for me.

薄暮涼年 2024-11-11 17:25:45

如果仍然无法解决问题并使用 mac,请按照此操作

1.转到根文件夹 /

  1. cd usr/local/etc/apache2/2.4

3.sudo nano httpd.conf

4.change #servername 为 ServerName 127.0.0.1:8080 按ctrl+o,+return+ctrl x

5.然后重启服务器 apachectl restart

who are still couldnt resolve the problem and using mac then follow this

1.goto the root folder /

  1. cd usr/local/etc/apache2/2.4

3.sudo nano httpd.conf

4.change #servername to ServerName 127.0.0.1:8080 press ctrl+o,+return+ctrl x

5.then restart the server apachectl restart

千秋岁 2024-11-11 17:25:45

如果您使用的是 Windows,请删除这些行上的注释并将它们设置为:

Line 227 : ServerName 127.0.0.1:80 
Line 235 : AllowOverride all 
Line 236 : Require all granted

为我工作!

If you are using windows, remove comment on these lines and set them as:

Line 227 : ServerName 127.0.0.1:80 
Line 235 : AllowOverride all 
Line 236 : Require all granted

Worked for me!

时光是把杀猪刀 2024-11-11 17:25:45

这是我的两分钱。也许这对未来的读者有用。

我在 Docker 容器中使用 Apache 时遇到了这个问题。当我从 Apache Web 服务器的映像启动容器时,当我使用 docker run -it -p 80:80 my-apache-container 启动容器时出现此消息。

但是,在分离模式下启动容器后,使用 docker run -d -p 80:80 my-apache-container ,我能够通过浏览器进行连接。

Here's my two cents. Maybe it's useful for future readers.

I ran into this problem when using Apache within a Docker container. When I started a container from an image of the Apache webserver, this message appeared when I started it with docker run -it -p 80:80 my-apache-container.

However, after starting the container in detached mode, using docker run -d -p 80:80 my-apache-container, I was able to connect through the browser.

来世叙缘 2024-11-11 17:25:45

我使用的是 ubuntu 22.04

我在位置 '/usr/local/apache2' 安装了 apache2

我刚刚编辑了 '/usr/local/apache2/conf/httpd.conf' 文件。

运行以下命令

cd /usr/local/apache2/conf

sudo nano httpd.conf

找到此注释

#ServerName www.example.com:80,在我的例子中,它位于第 197 行

,之后添加此

ServerName localhost >

不要修改此文件中的任何其他内容!

谢谢!

I am using ubuntu 22.04

I installed the apache2 at the location '/usr/local/apache2'

I just edited the '/usr/local/apache2/conf/httpd.conf' file.

run the following commands

cd /usr/local/apache2/conf

sudo nano httpd.conf

find this comment

#ServerName www.example.com:80, in my case it is at line 197

after that add this

ServerName localhost

don't modify anything else in this file!

Thank you!

暮凉 2024-11-11 17:25:45

尝试去做吧。

hostnamectl set-hostname youfirstdomain.com

vi /etc/hosts

添加此行,

0.0.0.0 youfirstdomain.com

而不是 0.0.0.0,输入您的服务器的 IP 地址

sudo systemctl restart apache2

Try to do it.

hostnamectl set-hostname youfirstdomain.com

vi /etc/hosts

add this line

0.0.0.0 youfirstdomain.com

Instead of 0.0.0.0 put your IP address of the server

sudo systemctl restart apache2
热风软妹 2024-11-11 17:25:45

出现以下错误,可能是由于权限问题,以 root 身份重新启动 apache 并且成功了!

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

Had the following error, it could be due to permissions, had restarted apache as root and it worked!

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文