NGINX Unicorn 504网关超时

我通过这个问题尝试了我在Google中find的所有内容,但没有任何结果。 反正它不起作用。

我的NGINX默认:

upstream app { server unix:/tmp/unicorn.rails.sock fail_timeout=0; } server { listen 80; root /home/rails/public; server_name _; index index.htm index.html; location / { try_files $uri/index.html $uri.html $uri @app; } location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ { try_files $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; } } 

NGINX错误日志:

  *12 connect() to unix:/tmp/unicorn.myapp.sock failed (2: No such file or directory) while connecting to upstream, client: 46.228.180.65, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.myapp.sock:/", host: "178.62.102.154" 

你能帮助解决吗?

/home/rails/config/unicorn.rb

 working_directory "/home/rails" pid "/home/rails/pids/unicorn.pid" stderr_path "/home/rails/log/unicorn.log" stdout_path "/home/rails/log/unicorn.log" listen "/tmp/unicorn.rails.sock" worker_processes 2 timeout 30 

发现nginx之间的区别:

上游应用程序{服务器unix:/ tmp /独angular兽。 myapp .sock fail_timeout = 0; }

而你的独angular兽configuration:

听“/ tmp / unicorn。rails .sock”

你应该指向两个相同的套接字…