Creating an API gateway using NGINX
Our deployment needs NGINX to manage the high traffic of incoming requests from clients, load balance the requests across the server groups, add some HTTP caches, or add security to filter suspicious access. NGINX is a stable HTTP server that can be installed on Linux-based operating systems. In this chapter, NGINX is part of our Docker deployment, which consists of our ch11-asgi
app and PostgreSQL database platform. It will serve as the facade of the Gunicorn server running our application.
Here, ch11-asgi-dep-nginx
is a Docker Compose folder consisting of the ch11-asgi
project directory, which contains a Dockerfile, the docker-compose.yaml
file, and the nginx
folder containing a Dockerfile and our NGINX configuration settings. The following is the nginx.conf
file that’s used by Compose to set up our NGINX server:
server { listen 80; server_name localhost; location...