Nginx welcome page not going away!

December 14, 2018 1.1k views
Nginx Django

I have analyzed all previous answers to this question and nothing is helping me. I have a django and nginx installation on a Ubuntu 16.04 droplet.

Here is the snippet from my /etc/nginx/sites-available/ , which also is linked to the /sites-enabled directory

server {
    listen       80;
    server_name   **my.droplet.IP.address**;
    charset      utf-8;

    client_max_body_size       10m;
    client_body_buffer_size    128k;

    # serve static files
    location /static/ {
        alias /home/**app-name**/app/static/;
    }

    location /home/ {
        include proxy_params;
        proxy_pass http://unix:/home/**app-name**/django.sock;
    }
}

If someone could please help me, everything seems to be pointing to the right folder, ironically I am trying to learn django but I can’t even get it installed right on the server!

I will be pending this thread so if any more information is needed please let me know!

1 comment
  • PS: I have deleted the default file and symbolic link, I have tried adding return 404 (it returns a 404 error instead of welcome to nginx LOL)

1 Answer

Hello,
After editing the conf file did you restart nginx?

sudo service nginx restart

when you delted the defualt link do you make a new conf file?

  • Hello! I did restart -
    sudo systemctl restart nginx

    Does that do the same as your code?

    I have not made a new conf file - I just deleted default in both folders (the file in available, the symbolic link in sites-enabled)

    If you wouldn’t mind, please be more specific about what conf file, where it is, what it should say or what I should search for in the documentation.

    Thank you for responding!

    • Hello,
      Once you restarted Nginx did you get any error messages?

      You can test Nginx with:

      sudo nginx -t 
      

      Please post the output of that command above, will help to track down the issue.
      In the Django config is the servername the same as the name in your nginx config?

      Did you happen to follow any sort of tutorial to install django and nginx. Digital ocean offers great tutorials. I have a feeling you may have missed a step. I have before and it drives me crazy!

      I would give this a read just to make sure nothing got missed:
      (assuming you have 16-04 installed you can change versions by using the drop down)
      https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

      by Justin Ellingwood
      Django is a powerful web framework that can help you get your Python application or website off the ground. Django includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server...
Have another answer? Share your knowledge.