Unicorn + Nginx Rails生成错误

时间:2016-01-15 20:18:50

标签: ruby-on-rails nginx unicorn

我正在关注this tutorial部署带有Capistrano的RoR应用程序,但我的生产服务器出错了

[error] 28314#0: *1 connect() to unix:/tmp/unicorn.myapp.sock failed (111: Connection refused) while connecting to upstream, client: xx.xxx.xx.xx, server: , request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.myapp.sock:/", host: "myapp.cloudapp.azure.com"

我的/etc/nginx/sites-available/default

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

server {

  listen 3000;
  server_name localhost;

  root /home/deploy/apps/myapp/current/;

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

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

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

我将server更改为许多不同的内容,但是我得到完全相同的错误,使用相同的主机,服务器,上游。

问题在于Unicorn,在我的Capistrano部署的某个地方,它没有重新启动Unicorn。

1 个答案:

答案 0 :(得分:2)

Nginx日志表明这是后端服务器的问题。在你的后端启动并运行之后。检查:

一旦这些测试通过,再次通过Nginx进行测试。