cURL有效,但浏览器无法加载

时间:2015-05-28 22:07:57

标签: nginx unicorn ruby-on-rails-4.2

我在NGINX应用中使用UnicornRails。我碰到了一堵砖墙,我不确定发生了什么。

我已将NGINX日志记录设置为完全调试。当我尝试浏览到我的站点主页时,我在NGINX错误日志中遇到问题加载页面而没有任何内容。当我使用cURL到达同一页面时,它完美运行,日志中充满了有用的信息。我希望这是NGINX配置文件中的一个明显错误:

upstream unicorn-soup {
  server unix:/home/soup/app/tmp/sockets/unicorn.sock;
}

server {
        listen 80 default;
        listen [::]:80 default;

        root /home/soup/app/current/public;

        server_name soup.quote2bill.com;

        try_files $uri/index.html $uri.html $uri @unicorn;

        location @unicorn {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-Forwarded_Proto $scheme;
                proxy_redirect off;

                proxy_pass http://unicorn-soup;
                proxy_read_timeout 300s;
                proxy_send_timeout 300s;
        }
}

注意我甚至尝试将其设置为默认站点并浏览到IP地址,但它没有帮助。

感谢您抽出时间和建议如何进行问题排查和/或修复。

1 个答案:

答案 0 :(得分:0)

固定!我删除了location行的try指令。

修正:

    location / {
            try_files $uri/index.html $uri.html $uri @unicorn;
    }