Report this

What is the reason for this report?

How to host Django Application using gunicorn & nginx in Production

Posted on July 12, 2021

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.



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!

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.