Question

Nginx pointing to django project via domain name, but pointing to default nginx page via IP

I have the following in /etc/nginx/sites-available/jobzumo:

server{
        listen 80;
        server_name 'jobzumo.com';
        location = /favicon.ico { access_log off; log_not_found $
        location /static/ {
        root /home/justin/project;
        }
        location / {
                include proxy_params;
                proxy_pass http://unix:/run/gunicorn.sock;
        }
}

If I visit jobzumo.com, I will see the default django rocket ship and everything is working fine. If I visit my IP I will see the default ‘welcome to nginx’ page. If I change the server_name to my IP instead of the ‘jobzumo.com’ domain name, the opposite will happen(Rocket ship at IP, welcome to nginx at domain). Does anyone know how to get both the IP and domain name to point at my django project?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

I can see that your website is already loading the Django installation. Would you mind sharing with the community how you solved the problem?

I believe that a possible issue that could be causing the problem is the server_name part in your configuration file, I would recommend not using quotes there.

Regards, Bobby