why does domain name and ip address still show default nginx page but next level url directs to correct django view?

Posted January 8, 2018 2.4k views
NginxDjangoUbuntu 16.04

after i registered a domain name and tied the domain name to my droplet’s ip address, i waited to see if the domain name would be active and show the correct django view which would be called with a url pattern specified as an empty python string “. shortly after registering the domain name, i used the droplets ip address in the browser as i knew it would take a while for my new domain name to propagate. using just the droplet’s ip address correctly called the appropriate django view that is called when the url matches a pattern of an empty python string ”. but later on when i tried typing in my domain name, the default nginx page appeared. then the same thing happened when i tried using the droplets ip address even though it had worked a little earlier. but then when i changed my django projects file to match a more specific url i.e ‘stats/’ instead of the empty python string “, using the domain name ( and the droplets ip address with /stats appended, it worked. why isnt nginx passing the empty url/plain domain name/ip address to the view that’s tied to the empty python string ” url pattern?

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
3 answers

lol, never mind. i figured out the answer. so i totally forgot that prior to tying a domain name to my droplet, i had already configured/enabled nginx to route to this other django project i was working on but abandoned and i forgot to rm the symlink to that old site. so when i added a new nginx site, the server_name was for an ip address that was also in another conf. and if the url isn’t specific enough, i guess nginx will just default to nginx page.