Final step: domain name - nginx

April 13, 2019 433 views
Django Nginx

I’ve uploaded my first django app to the web. I’m working with Ubuntu 16.04 because I have seen it has lots of documentation. I can see my web app when I type the IP Address of it on the web browser.

I purchased a domain name at GoDaddy, let’s call it ‘example.com’. I have already set the DigitalOcean DNS at my domain, following the instructions of this tutorial: [https://www.digitalocean.com/community/tutorials/how-to-point-to-digitalocean-nameservers-from-common-domain-registrars](http://), and have tried to link it with the IP Address.

At the end, when I type 'example.com’ it shows me 'Internal Server Error’, unlike the IP Address which works perfectly. I tried to add the domain name at the nginx server without success. How can I link my domain name with the IP Address?

PS: I have read that most of the people link the domain name with the IP Address before configuring everything else. Should I delete my dropplet and start it over again?

1 Answer

Hi

Can you post the Nginx configs here?

Cheers

  • Hello,

    Thank you for your interest.

    The Nginx config looks like something like this.

    server {
        listen 80;
        server_name 65.40.90.xxxx;
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
            root /home/sammy/myproject;
        }
    
        location / {
            include proxy_params;
            proxy_pass http://unix:/home/sammy/myproject/myproject.sock;
        }
    }
    
    server {
        listen 80;
        server_name example.com;
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location /static/ {
            root /home/sammy/myproject;
        }
    
        location / {
            include proxy_params;
            proxy_pass http://unix:/home/sammy/myproject/myproject.sock;
        }
    }
    
Have another answer? Share your knowledge.