我手动使用此命令
bundle exec puma -e production -b unix:///var/www/rails_apps/agarcents/shared/tmp/sockets/puma.sock
我的服务器工作正常。我能够访问网址但是当我用nginx绑定套接字时,我无法访问服务器。
我的nginx配置是
upstream puma_agarscents {
server unix:/var/www/rails_apps/agarcents/shared/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name x.x.x.x; # change to match your URL
root /var/www/rails_apps/agarcents/current/public;
listen 443 ssl;
location / {
proxy_pass http://puma_agarscents;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location ~* ^/assets/ {
# Per RFC2616 - 1 year maximum expiry
expires 1y;
add_header Cache-Control public;
# Some browsers still send conditional-GET requests if there's a
# Last-Modified header or an ETag header even if they haven't
# reached the expiry date sent in the Expires header.
add_header Last-Modified "";
add_header ETag "";
break;
}
}
获得以下错误
2015/05/14 05:34:31 [错误] 6802#0:* 79 connect()to unix:/var/www/rails_apps/agarcents/shared/tmp/sockets/puma.sock failed (11:资源暂时不可用)连接上游时, client:x.x.x.x,server:x.x.x.x,request:“GET /favicon.ico HTTP / 1.1“,上游: “http://unix:/var/www/rails_apps/agarcents/shared/tmp/sockets/puma.sock:/favicon.ico”, 主持人:“x.x.x.x”