Nginx   发布时间:2022-05-11  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了NGINX Unicorn 504网关超时大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我尝试了通过这个问题在Google中找到的所有内容,但是 – 没有.它无论如何都不起作用.

我的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之间的差异:

上游应用程序{server unix:/tmp/unicorn.myapp.sock fail_timeout = 0; }

你的独角兽配置:

听“/tmp/unicorn.rails.sock”

您应该将两者都指向同一个套接字……

大佬总结

以上是大佬教程为你收集整理的NGINX Unicorn 504网关超时全部内容,希望文章能够帮你解决NGINX Unicorn 504网关超时所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: