Django 无法使用gunicorn运行nginx,连接到上游时出现权限被拒绝错误
我与nginx和gunicorn共同主持了django。我得到以下错误Django 无法使用gunicorn运行nginx,连接到上游时出现权限被拒绝错误,django,nginx,centos,Django,Nginx,Centos,我与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.
# 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>
有人能帮我吗?此错误消息意味着,如果您在linux环境中,您对服务“favicon.ico”的根文件夹没有读写权限 尝试此命令:
sudo chmod 775/
不要忘记命令开始时的sudo
然后,在应用权限后,尝试重新启动*nginx服务器
使用
netstat-tulpn | grep8001
1检查该端口上是否正在运行任何其他内容。它已经关闭了,当复制粘贴其他编辑器时,错误地显示了注释,它没有注释,它正确关闭了。2.在nginx.conf中,用户ftpuse1已经存在,那么在您创建它时,用户本身可能没有权限?我递归地将源代码的权限更改为777,所有者是ftpuser1。我重新启动了nginx,但仍然存在问题。
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;
#} }