Web Server Configuration (Nginx)¶
Nginx acts as the primary web server and reverse proxy for the backend. It sits in front of Gunicorn, fielding HTTP requests, serving static assets, routing traffic to the Python application via a Unix socket, and managing communication with Cloudflare.
Nginx Server Block¶
Because the main domain is purchased and managed via Cloudflare, the backend is routed through a specific subdomain (mkt-api.socon-mkt.com). Cloudflare handles the edge SSL termination, so Nginx is configured to correctly parse the forwarded headers.
Create the Nginx configuration file:
sudo nano /etc/nginx/sites-available/socon_mkt