1
我正在使用Puma運行我的rails應用程序,並試圖使我的nginx配置指向它。我發現了以下錯誤在我的Nginx的錯誤日誌:嘗試訪問Puma套接字時,nginx權限被拒絕
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public//index.html" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public/" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 connect() to unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock failed (13: Permission denied) while connecting to upstream, client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock:/", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public/500.html/index.html" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock/", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public/500.html" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock/", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 connect() to unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock failed (13: Permission denied) while connecting to upstream, client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock:/500.html", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public//index.html" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public/" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 connect() to unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock failed (13: Permission denied) while connecting to upstream, client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock:/", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public/500.html/index.html" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock/", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 stat() "/home/rails/acceptable-trader/current/public/500.html" failed (13: Permission denied), client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock/", host: "trade.acceptableice.com"
2016/05/15 15:18:41 [crit] 1611#0: *31 connect() to unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock failed (13: Permission denied) while connecting to upstream, client: 66.253.181.206, server: , request: "GET/HTTP/1.1", upstream: "http://unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock:/500.html", host: "trade.acceptableice.com"
我試圖改變可接受的貿易商,puma.sock及其父文件夾由www數據所擁有,但沒有似乎做任何事情。
我nginx的站點文件是:
upstream puma {
server unix:///home/rails/acceptable-trader/shared/tmp/sockets/acceptable-trader-puma.sock;
}
server {
listen 80 default_server deferred;
# server_name example.com;
root /home/rails/acceptable-trader/current/public;
access_log /home/rails/acceptable-trader/current/log/nginx.access.log;
error_log /home/rails/acceptable-trader/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;
}
我得到「該程序'setenforce'目前尚未安裝,您可以通過鍵入apt-get install selinux -utils「當我嘗試setenforce寬容時,這讓我覺得我沒有安裝SELinux。此外,我給了套接字文件夾的權限:drwxrwxr-x 2 www-data www-data 4096 5月15日14:48 sockets –
好的,我做了所有我的chown命令,分組爲:user,而不是user:group。這樣做正確解決了它。感謝您試圖幫助我! –