Nginx警告“服务器名称冲突 在0.0.0.0:80,忽略“

问题描述 投票:2回答:1

我查看了几个论坛和StackOverflow问题,但我真的不知道为什么这不起作用。

我在Digital Ocean Droplet上运行了一个Ghost.org博客,并根据this tutorial进行了配置。我拍了快照并在一周前销毁了液滴。此刻一切都很好。

今天,我用相同的快照创建了一个新的Droplet。由于IP不同,我相应地修改了域设置,它也反映在我的计算机上。然后我尝试访问该网站,但连接超时。即使在一个小时左右之后,它也会超时,所以我认为这不是DNS传播的错误。对whatsmydns.net的简单检查也证实了这不是问题。

经过进一步调查,我发现/var/log/nginx/error.log中有以下一行 - 今天的唯一一行:

2016/05/29 16:32:10 [warn] 988#0: conflicting server name "foobar.com.tld" on 0.0.0.0:80, ignored

我已经检查了两个我知道可能会发生冲突的配置 - nginx.confsites-enabled/ghost(符号链接到sites-available/ghost)的任何冲突 - 我似乎找不到任何冲突。

我对nginx不是很满意 - 这是我第一次接触它,但是我现在已经超过2.5小时了,我真的很感激一些帮助。

nginx.confhttp://pastebin.com/YUhBZVhX sites-enabled/ghosthttp://pastebin.com/3cdZgTG3 www/ghost/config.jshttp://pastebin.com/iunffMzN

编辑:/etc/nginx/conf.d/文件夹为空,因此没有冲突。

编辑2:最简单的配置:

server {
    listen 80;
    server_name foobar.com;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
    }
}

似乎也没有用。我做了这个改变后确实重新启动了nginx服务,并相应地修改了Ghost的config.js并重新启动了它的服务。

编辑3:sites-enabled文件夹中没有隐藏或备份文件。

nginx ghost
1个回答
0
投票

一旦你确认foobar.com没有在你的Nginx配置中的任何其他地方的server_name中使用,请查找$hostname或其他Nginx变量,其值可能与您的server_name匹配:

Alphabetical index of Nginx variables

例:

server {
    server_name localhost $hostname;
    listen 80;

    access_log off;
}

让我困惑了一段时间。

© www.soinside.com 2019 - 2024. All rights reserved.