[英]Could not run nginx with gunicorn, getting permission denied error while connecting to upstream
我已經用Nginx和Gunicorn托管了django。 我收到以下錯誤。
# 1 connect() to 127.0.0.1:8001 failed (13: Permission denied) while connecting to upstream, client: 106.77.61.123, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8001/favicon.ico", host: "<domainname>
[相同的配置正在我的本地centos機器上工作]
但是在VPS托管環境(vps)上:
我正在使用具有用戶名“ ftpuser1”的centos-7(nginx.conf中的用戶名是“ ftpuser1”)。
我正在使用用戶“ ftpuser1”運行nginx
/ var / cache / nginx的所有者遞歸具有777權限的“ ftpuser1”
源代碼路徑的所有者也是具有777權限的“ ftpuser1”
這是我的/etc/nginx/conf.d/default.config配置文件的內容:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /home/ftpuser1/donation/templates;
index home.html;
proxy_pass http://127.0.0.1:8001;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#} }
有人可以幫我嗎?
此錯誤消息表示,如果您在Linux環境中,則您對提供服務“ favicon.ico”的根文件夾沒有讀寫權限;
嘗試以下命令: sudo chmod 775 /<foldername>
在sudo
開始時不要忘記sudo
。
然后,在您應用權限之后,嘗試重新啟動* nginx服務器
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.