简体   繁体   中英

Showing default nginx page instead of application

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;
    }
}

error:

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

Although I have project.sock in the shown location, I've bought domain, connected DigitalOcean's DNS Servers, set up everything as in DigitalOceans's official manual. But still seeing this trashy nginx default page instead of application.

Change the ownership of the folder where .sock file is located to nginx user and group. For your case, try

> sudo chown -R www-data:www-data /home/progbash/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM