加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

NGINX Unicorn 504网关超时

发布时间:2020-12-13 21:17:58 所属栏目:Nginx 来源:网络整理
导读:我尝试了通过这个问题在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 i

我尝试了通过这个问题在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”

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读