显示默认的Nginx页面而不是应用程序

settings.py

ALLOWED_HOSTS = ['64.225.1.249','domain.az']

nginx:

server {
    listen 80;
    server_name domain.az;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/progbash/ccproject;
    }

    location / {
        proxy_set_header Host $host;
        include proxy_params;
        proxy_pass http://unix:/home/progbash/ccproject.sock;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

错误:

2019/12/12 02:51:50 [crit] 23765#23765: *1 connect() to unix:/home/progbash/ccproject.sock failed (2: No such file or directory) while connecting to upstream,client: 188.253.227.99,server: domain.az,request: "GET / HTTP/1.1",upstream: "http://unix:/home/progbash/ccproject.sock:/",host: "domain.az"
2019/12/12 03:05:57 [alert] 24056#24056: *12 open socket #3 left in connection 4
2019/12/12 03:05:57 [alert] 24056#24056: *13 open socket #11 left in connection 5
2019/12/12 03:05:57 [alert] 24056#24056: aborting
2019/12/12 03:09:16 [alert] 24143#24143: *11 open socket #11 left in connection 3
2019/12/12 03:09:16 [alert] 24143#24143: *12 open socket #12 left in connection 5
2019/12/12 03:09:16 [alert] 24143#24143: aborting

尽管我在所示位置有project.sock,但我已经购买了域,已连接DigitalOcean的DNS服务器,并按照DigitalOceans的官方手册进行了所有设置。但是仍然看到这个混乱的nginx默认页面而不是应用程序。

luoyanzheng 回答:显示默认的Nginx页面而不是应用程序

将.sock文件所在的文件夹的所有权更改为nginx用户和组。 对于您的情况,请尝试

> sudo chown -R www-data:www-data /home/progbash/
本文链接:https://www.f2er.com/2937181.html

大家都在问