简体   繁体   中英

Rails, Nginx, Puma access right error (puma.sock highlighted in pink when perform ls -l)

I am trying to deploy my rails application (Nginx + Puma) however it seems that there is some user right issues that associated with it.

The error message from "nginx.error.log" is as follows:

2015/11/12 09:07:23 [error] 1148#0: *10 connect() to 
unix:///home/deploy/apps/app_name/shared/tmp/sockets/xxx-puma.sock failed 
(111: Connection refused) while connecting to upstream, client: 61.6.11.121,
server: 168.63.241.117, request: "GET / HTTP/1.1", 
upstream: "http://unix:///home/deploy/apps/app_name/shared/tmp/sockets/xxx-puma.sock:/", 
host: "xxx"

When I enter the directory that contains the puma.sock file and perform a "ls -l" I have noticed the following: Puma Directory

I have done the exact same settings (capistrano) on my deployment server and replicated it onto my staging server. The only difference between the both is that the puma.sock on my staging server is highlighted in pink color (I suspected it's related to user access right)

Anyone can help me on the issues? Thanks in advance.

Update (nginx.conf):

upstream puma {
  server unix:///home/deploy/apps/app_name/shared/tmp/sockets/puma.sock;
}

server {
  listen 80;

  server_name xxx;

  root /home/deploy/apps/app_name/current/public;
  access_log /home/deploy/apps/app_name/current/log/nginx.access.log;
  error_log /home/deploy/apps/app_name/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

I think you miss Procfile

Create a Procfile and add the following code in

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

You've specified app_name-puma.sock in upstream nginx conf and your actual socket file is named puma.sock

try changing:

upstream puma {
  server unix:///home/deploy/apps/app_name/shared/tmp/sockets/app_name-puma.sock;
}

to:

upstream puma {
  server unix:///home/deploy/apps/app_name/shared/tmp/sockets/puma.sock;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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