在部署rails之后nginx 502 Bad Gateway

时间:2015-05-14 08:44:16

标签: ruby-on-rails nginx unicorn

我正在使用nginx和unicorn部署rails应用程序并获得502糟糕的攻击。<​​/ p>

有人可以帮我解决这个问题吗?非常感谢你

我的Nginx错误日志(/var/log/nginx/error.log)显示:

@user.password_hash
  

/etc/nginx/conf.d/default.conf:

 2015/05/14 00:26:22 [crit] 24642#0: *13 connect() to unix:/tmp/unicorn.easysign.sock failed (2: No such file or directory) while connecting to upstream, client: 89.100.32.54, server: localhost, request: "GET /easysign HTTP/1.1", upstream: "http://unix:/tmp/unicorn.easysign.sock:/500.html", host: "mysite.com"
  

/ var / www / [app name] /config/unicorn.rb:

upstream app {
    # Path to Unicorn SOCK file, as defined previously
    server unix:/tmp/unicorn.easysign.sock fail_timeout=0;
}

server {
    listen 80;
    server_name localhost;

    root /var/www/mysite.com/public_html/easysign;

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

    location @app {
        proxy_pass http://app;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
    }

    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
}

1 个答案:

答案 0 :(得分:1)

请尝试将套接字的路径(例如)更改为&#34; /var/www/sockets/unicorn.easysign.sock"。不要忘记创建&#34; / var / www / sockets&#34;目录。也许特权存在问题?