我查看了几个论坛和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.conf
和sites-enabled/ghost
(符号链接到sites-available/ghost
)的任何冲突 - 我似乎找不到任何冲突。
我对nginx不是很满意 - 这是我第一次接触它,但是我现在已经超过2.5小时了,我真的很感激一些帮助。
nginx.conf
:http://pastebin.com/YUhBZVhX
sites-enabled/ghost
:http://pastebin.com/3cdZgTG3
www/ghost/config.js
:http://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
文件夹中没有隐藏或备份文件。
一旦你确认foobar.com
没有在你的Nginx配置中的任何其他地方的server_name
中使用,请查找$hostname
或其他Nginx变量,其值可能与您的server_name
匹配:
Alphabetical index of Nginx variables
例:
server {
server_name localhost $hostname;
listen 80;
access_log off;
}
让我困惑了一段时间。