简体   繁体   English

Unicorn + Nginx Rails生产错误

[英]Unicorn + Nginx Rails production error

I'm following this tutorial to deploy a RoR app with Capistrano but I'm getting an error in my production server 我正在按照本教程使用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"

My /etc/nginx/sites-available/default 我的/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;
}

I changed the server to many different things, but I get the exact same error, with the same host, server, upstream. 我将server更改为许多不同的东西,但是在上游使用相同的主机,服务器时,我得到了完全相同的错误。

The problem was with Unicorn, somewhere in my Capistrano deploy, it wasn't restarting Unicorn as it should. 问题出在独角兽,在我的Capistrano部署中的某个地方,它没有像应该那样重新启动独角兽。

Nginx logs indicate that this is an issue with the backend server. Nginx日志表明这是后端服务器的问题。 After your backend up is up and running. 后端启动并运行之后。 Check: 校验:

Once those tests pass, test again through Nginx. 一旦这些测试通过,请再次通过Nginx进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM