Configure the Proxy Server
Explore how to configure the proxy server for your web application deployment. Understand installing NGINX with Heroku buildpacks, customizing NGINX configurations to serve static files and API requests, and binding Gunicorn with NGINX via Unix socket. Learn how to set up the Procfile to launch both servers for a smooth production deployment on Heroku.
We'll cover the following...
Installing NGINX
NGINX is not a Python package, so it can’t be inferred from the Pipfile. Instead, we need to explicitly tell Heroku to install it using the buildpack.
$ heroku buildpacks:add heroku-community/nginx
NGINX configuration
The easiest way to set up NGINX is to serve files from a directory. However, that’s not going to be good enough here, so we need to look into customizing its configuration file. We’ll put our NGINX and Gunicorn configuration files in a new config directory at the top ...