Question

How to resolve This (django) site can’t be reached with nginx, gunicorn, droplet ?

Posted May 7, 2021 63 views
NginxDjangoDigitalOcean Droplets

I was following this tutorial for deploying my django project to digitalocean droplet [https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04]. But I have been facing this issue for last 2 days. Here are my configuration files:
/etc/nginx/nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
        worker_connections 768;
}


http {
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

    server {
        listen          80;
        server_name     167.71.233.157;
        location / {
                proxy_pass http://unix:/run/gunicorn.sock;
        }
    }

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    client_max_body_size 100M;
}

/etc/nginx/sites-enabled/lavisco_ecommerce

server {
    listen 80;
    server_name 167.71.233.157;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/lavisco/Lavisco_Ecommerce;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
    }
}
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!