Question

Why Nginx showing me Nginx's welcome page instead of my home page??

Posted July 13, 2021 96 views
NginxDjangoPython Frameworks

I am using django and gunicorn to run my website I do everything to run my site but when I am going to search my domain name it show me the welcome page of nginx.

This is my harshblog.socket file

[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/harshblog.sock

[Install]
WantedBy=sockets.target

This is my harshblog.service file

[Unit]
Description=gunicorn daemon
Requires=harshblog.socket
After=network.target


[Service]
User=harsh
Group=www-data
WorkingDirectory=/home/harsh/harshblog
ExecStart=/home/harsh/harshblog/env/bin/gunicorn \
    --access-logfile - \
    --workers 3 \
    --bind unix:/run/harshblog.sock \
    harshbloging.wsgi:application

Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

This is my site-enabled file

server {
    listen 8000;
    server_name www.harshblog.tech;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/harsh/harshblog;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/harshblog.sock;
    }
}

I used port 80 also but it can’t solve my problem. So, Please help me I am in trouble.

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.

×
Submit an Answer
1 answer

Hi @harshku2630,

First, you need to set the listen directive to port 80 rather than 8000. After that in your server_name directive, add harshblog.tech and www.harshblog.tech not only one of them.

Restart Nginx and see if that would work for you.