Writing NGINX Configuration

Configure NGINX for backend deployment.

We'll cover the following

NGINX requires some configuration from our side. If there is a request on the HTTP port of the machine (by default 80), it should redirect the requests to port 8000 of the running Django application. Put simply, we will write a reverse proxy. A proxy is an intermediary process that takes an HTTP request from a client, passes the request to one or many other servers, waits for a response from those servers, and sends back a response to the client.

By using this process, we can forward a request on the HTTP port 80 to port 8000 of the Django server.

At the root of the project, create a new file called nginx.conf. Then, let’s define the upstream server that HTTP requests will be redirected to:

Get hands-on with 1400+ tech skills courses.