Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

ruby on rails - Nginx not able to connect to thin server

My rails application on newly configured server is giving NGINX 502 error, same nginx configuration is working for other servers running same application /tmp/thin.2.sock file is being created correctly when i start my application and my application is working properly in background

Nginx error log:

2021/01/25 13:34:30 [crit] 1966#0: *49 connect() to unix:/tmp/thin.2.sock failed (2: No such file or directory) while connecting to upstream, client: XX.XXX.X.XXX, server: domain.com, request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/thin.2.sock:/", host: "domain.com"

Nginx configuration file:

upstream  appuser{
       server   unix:/tmp/thin.0.sock;
       server   unix:/tmp/thin.1.sock;
       server   unix:/tmp/thin.2.sock;
    }

server {
        listen       80 ;
        server_name  domain.com;
        root         /home/appuser/app_name/public;
        access_log   /home/appuser/app_name/log/access.log;
        error_log    /home/appuser/app_name/log/error.log;
        index        index.html;

        gzip            on;
        gzip_comp_level 3;
        gzip_types      text/plain text/css application/javascript image/*;

                location / {
                 proxy_set_header  X-Real-IP  $remote_addr;
                 proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
                 proxy_set_header  Host $http_host;
                 proxy_redirect    off;
                 try_files /system/maintenance.html $uri $uri/index.html $uri.html @ruby;
                 client_max_body_size 6m;
             }

              location @ruby {
                  proxy_pass http://appuser;
              }

        }
question from:https://stackoverflow.com/questions/65886205/nginx-not-able-to-connect-to-thin-server

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...