Nginx 网站未被选中

Nginx 网站未被选中

我的新网站未被选中。我创建了appycontrol.staging

upstream appycontrol_staging {
  server unix:///var/www/appycontrol.staging/shared/sockets/puma.sock;
}

server {
    listen 80 default_server;
    server_name control-staging.somedomain.com;
    root /var/www/appycontrol.staging/current/public;

    location / {
            proxy_pass http://appycontrol_staging;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

我在目录中添加了一个符号链接sites-enabled

[Staging] deploy@localhost:~$ ls -l /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 45 Nov  3  2015 appyengine.staging -> /etc/nginx/sites-available/appyengine.staging
lrwxrwxrwx 1 root root 46 Jul  7 06:03 appycontrol.staging -> /etc/nginx/sites-available/appycontrol.staging

我已经重新启动了 nginx:

sudo service nginx restart

但是该网站却选择了 control-staging.somedomain.com appyengine.staging

我错过了什么?

答案1

您可能在其他配置文件中使用了通配符域,或者由于某种原因启动 nginx 失败。

///var/应该只是/var/

答案2

检查了 nginx 错误日志后,我发现了以下信息:

2016/07/11 03:53:40 [emerg] 10446#0: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/appyengine.staging:6

所以我将第 6 行改为listen 80并重新启动 nginx。然后它就起作用了。

相关内容