H4 Tech Solutions Logo
All articles

Deploy Django with SSL and Nginx on Google Cloud Platform Using Ubuntu VM

A step-by-step guide to deploying Django with SSL and Nginx on GCP for secure and scalable web applications.

Feb 13, 2020 · 1 min read · Som

Deploy Django with SSL and Nginx on Google Cloud Platform Using Ubuntu VM

Getting Django to production means putting a proper web server and TLS in front of it. This guide walks through a Gunicorn + Nginx + Let's Encrypt setup on a GCP Ubuntu VM.

The stack

  • Gunicorn runs the Django WSGI app.
  • Nginx terminates TLS and serves static files / proxies to Gunicorn.
  • Certbot (Let's Encrypt) issues and renews the SSL certificate.

The flow

  1. Provision an Ubuntu VM and open ports 80/443 in the firewall.
  2. Install dependencies and run Django under Gunicorn (via systemd).
  3. Configure Nginx as a reverse proxy to the Gunicorn socket.
  4. Run Certbot to enable HTTPS and auto-renewal.

Takeaway

Separate concerns: Gunicorn serves the app, Nginx handles TLS and static assets, and Certbot keeps certificates fresh — a pattern that scales well beyond one VM.

Subscribe

Get new articles, white papers, and repos from H4Tech in your inbox.

Follow along via Subscribe via RSS