'Django digital ocean droplet isn't showing the website when connected with a namecheap domain
So I'm using a Django Digital Ocean droplet to run a website. I recently tried connecting the IP address of the droplet to a namecheap domain name, but when I connected them it only showed this on the domain:
Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.
Thank you for using nginx.
However, the website was working as intended on the IP address, can anyone tell me how to fix this?
my abbreviated /etc/nginx/sites-available/default
file
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name sanskarhandicrafts.com;
location / {
try_files $uri $uri/ =404;
}
}
I'm happy to provide more details
Solution 1:[1]
remove this line:
try_files $uri $uri/ =404;
used below code for location:
location / {
proxy_pass http://"YOU_IP_ADDRESS":"YOUR_PORT";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |