Django + Nginx configuration: why getting “Welcome to nginx!"?

I have Django + Nginx + Gunicorn on Ubuntu. Certificates generated with Letsencrypt.

In /etc/nginx/sites-available/myproject I have:

server {
    listen 80;
    return 301$request_uri;

server {

    listen 443;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;

    client_max_body_size 1G;

    root /home/myname/myproject;

    location / {
        include proxy_params;
        proxy_pass https://unix:/home/myname/myproject/myproject.sock;

In /etc/nginx/sites-available/default, except commented lines, I have:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
            try_files $uri $uri/ =404;

In /etc/nginx/sites-enabled I have default and myproject.

When I go to, I see “Welcome to nginx!”. What am I doing wrong that it redirects to “Welcome to nginx!”?


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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Did you try removing default from /etc/nginx/sites-enabled?

sudo rm /etc/nginx/sites-enabled/default

I wish someone would answer this I have the same problem!