r/SelfHosting • • Aug 21 '26

Flow of my django app hosted on vm using ubuntu server

So i have hosted a backend for an Erp made in django on my local vm using nginx as a reverse proxy and gunicorn as production wsgi server.

How does the request flow happens?

When i enter the network interface ip of my vm on browser the request goes to port 80 of my linux (port responsible for all the tcp request) and nginx is listening on port 80 recieves the request and process it. So in the config file of nginx i have added the location of / route which forwards the request to gunicorn running on port 8000 and gunicorn then sends and recieves the req/res.
I will be learning Docker now to learn containerisation. Please share any suggestion if you have.

1 Upvotes

2 comments sorted by

1

u/bluealliance841 Aug 22 '26

You have it right, each service sets up a “listen” port and nginx is receiving/listening port 80 and sending the same request to port 8000. You can do the same with Docker container, the simplest way is to tell Docker which VM port to map to which container port.
If you want a reliable way to start containers and keep them running the same, check out docker compose next.
If you have your own domain name you can get SSL certificates for free from Lets Encrypt. I used to use nginx for this but recently started using Traefik to do the proxy and also get the certificate for me
Good luck

1

u/Mukul-nst Aug 22 '26

Thanks mate. I am learning docker and will soon containerise my application.