Question

How to host Django Application using gunicorn & nginx in Production

Hello I have 2 Django Application that I want to run in a same server and I have 2 domain name. Please tell me how to host this 2 Django Application in same server this is the domain and file locations for my application.

  1. First Application —> Domain --> harshblog.tech file location for my project --> /home/harsh/harshblog file location for my python environment --> /home/harsh/harshblog/env file location for my wsgi.py --> /home/harsh/harshblog/harshbloging/wsgi.py

  2. Second Application --> Domain --> kingofmemes.xyz file location for my project --> /home/harsh/harshmemes file location for my python environment --> /home/harsh/harshmemes/env file location for my wsgi.py --> /home/harsh/harshmemes/memes/wsgi.py

If you need more information related to this 2 Application please tell me and please help me. This 2 application is running on apache2 in different server. So, I want to run this 2 applications in nginx in a same server.


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,

This should be achievable with Nginx server blocks as per this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

Once you have your two Nginx server blocks, you can configure them as per the instruction in the Configure Nginx to Proxy Pass to Gunicorn step in this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

Hope that this helps! Regards, Bobby