Topic · Hosting & servers

Linux servers & VPS for Django in production

Running Django on a virtual server you administer: provisioning, users, disks, memory, and the operating system underneath.

one server, every layer is yoursNginxTLS, static files, proxyGunicorn under systemdrestarts, sockets, logsPostgreSQL and Redisbound to localhostUbuntu, ufw, SSH keysupdates and hardeningA VPS is the cheapest way to learn exactly what production needs

Running Django on your own Linux server means owning every layer: the operating system, the firewall, the database, the proxy, and the processes. It is the cheapest option and the clearest way to learn what production needs.

The guides cover setting up and hardening a VPS, provider-specific routes such as DigitalOcean, Hetzner, and Linode, and the maintenance that keeps a server healthy afterwards.

22Set it up
3Run it well
2Check it
16Fix it

Set it up

Guides that take this from nothing to running in production.

  • Deploy Django with Gunicorn and Nginx on Ubuntu

    Moving a Django app from local development to production usually fails on the same points: process management, reverse proxy configuration, static files, secrets, TLS, and safe...

  • How to Deploy Django on a DigitalOcean Droplet

    If you want to deploy Django on a DigitalOcean Droplet, you need more than python manage.py runserver.

  • Deploy Django on a Hetzner Cloud Server

    Provision a Hetzner Cloud server with the hcloud CLI, cloud firewall, and cloud-init, then run Django with Gunicorn, Nginx, PostgreSQL, and backups.

  • Host Multiple Django Sites on One Server

    Run several Django projects on one server safely: separate users and virtualenvs, systemd templates, per-site databases, and Nginx blocks.

  • Deploy Django on Akamai Cloud (Linode)

    Deploy Django on an Akamai Cloud (Linode) compute instance with a Cloud Firewall, Gunicorn, Nginx, managed PostgreSQL, Object Storage for media, and backups.

  • Deploy Django on Rocky Linux with SELinux

    Deploy Django with Gunicorn and Nginx on Rocky Linux, AlmaLinux, or RHEL with SELinux enforcing: firewalld, file contexts, booleans, and reading AVC denials.

  • Deploy Django on Vultr

    Deploy a Django app on a Vultr cloud compute instance: choose a plan and region, lock down SSH and the Vultr firewall, install Python, PostgreSQL, Gunicorn, and Nginx, add HTTPS, and set up backups and snapshots.

  • Deploy Django on Oracle Cloud Free Tier

    Deploy Django on Oracle Cloud Always Free resources: create an Ampere A1 Arm instance, open ports in both the security list and the instance iptables, install the stack on Ubuntu, and know the free tier's limits and reclaim rules.

  • Run Django in Production on a Raspberry Pi

    Run a Django app reliably on a Raspberry Pi 4 or 5: use 64-bit Raspberry Pi OS on an SSD instead of an SD card, run Gunicorn and Nginx under systemd, expose it safely with Cloudflare Tunnel, and back up off the device.

  • Move a Django Site to a New Server

    Migrate a production Django site to a new server or provider with minimal downtime: rebuild the stack from code, copy media with rsync, move PostgreSQL with dump and restore or replication, lower DNS TTL, cut over, and keep the old server as a fallback.

  • Deploy Django on Google Compute Engine

    Deploy Django on a Google Compute Engine VM: create an e2 instance with a service account, install Gunicorn and Nginx, connect to Cloud SQL through the Auth Proxy, store media in Cloud Storage, open firewall rules, and add HTTPS.

  • Deploy Django on NixOS With a Declarative Configuration

    Deploy Django on NixOS: define Gunicorn, PostgreSQL, Redis, Nginx, and ACME certificates in configuration.nix, package the app with a Python environment, manage secrets with agenix or sops-nix, and roll back safely with generations.

  • Deploy Django on FreeBSD With Gunicorn, Nginx, and rc.d

    Deploy Django on FreeBSD 14: install Python, PostgreSQL, and Nginx from packages, run Gunicorn as an rc.d service with daemon(8), configure pf firewall rules, get certificates with acme.sh or certbot, and optionally isolate the app in a jail.

  • Best Hosting Options for Django Deployment in 2026

    Choosing the best hosting for Django deployment is not about finding the cheapest server or the most popular cloud.

  • Deploy Django on AWS EC2 Step by Step

    To deploy Django on AWS EC2 reliably, you need more than python manage.py runserver.

  • Deploy Django on AWS Lightsail

    Deploy Django on an AWS Lightsail instance with a static IP, firewall rules, Gunicorn, Nginx, HTTPS, and an optional Lightsail managed PostgreSQL database.

  • Provision a Django Server with cloud-init

    Use cloud-init user data to provision a Django-ready Ubuntu server on first boot: users and SSH keys, packages, firewall, swap, directories, systemd units, and verification.

  • Deploy Django from a Private Git Repository with Deploy Keys

    Let a Django server pull code from a private GitHub, GitLab, or Bitbucket repository with read-only deploy keys: SSH config aliases, known_hosts, private dependencies, and alternatives.

  • Deploy Django on a Single-Node k3s Cluster

    Run Django on a single-node k3s Kubernetes cluster: install k3s, use the bundled Traefik ingress with cert-manager for Let's Encrypt, keep PostgreSQL outside the cluster or back it up properly, and deploy with manifests or Helm.

  • Docker vs a Plain VPS for Django

    Should you deploy Django with Docker or directly on a VPS with systemd? Compare reproducibility, deploy workflow, performance, debugging, security updates, and team skills, with a recommendation for solo developers, small teams, and growing apps.

  • Deploy django CMS to Production

    Deploy a django CMS site to production: configure settings for CMS and filer, PostgreSQL, media on object storage, static files, caching of rendered pages and menus, search engine friendly URLs, and a release process for template and plugin changes.

  • Connect Django Servers Over a WireGuard Private Network

    Use WireGuard to connect Django app servers to PostgreSQL, Redis, and workers across hosts or providers: generate keys, configure wg0 interfaces, bind databases to the tunnel address, restrict firewalls, and keep Django connection settings on private IPs.

Run it well

Tuning, reliability, and operations once it works.

  • Add Swap to a Small Django Server

    Add a swap file to a 1-2 GB Django server so pip installs, migrations, and traffic spikes do not trigger the OOM killer: sizing, fstab, swappiness, Docker and cloud caveats, and when swap is the wrong fix.

  • How to Rotate Django and Gunicorn Logs on Linux

    Django and Gunicorn log rotation becomes a production issue as soon as your app writes request logs, error logs, or application logs to disk for more than a few days.

  • Enable Automatic Security Updates on a Django Server

    Keep a Django server patched automatically: unattended-upgrades on Ubuntu and Debian or dnf-automatic on RHEL, security-only origins, service restarts, reboot windows, exclusions for PostgreSQL, and monitoring.

Check it

Review lists to run before launch or after a change.

  • Checklist for Decommissioning an Old Django Server

    Shut down an old Django server safely after a migration: confirm no traffic or jobs remain, take final backups, export logs, revoke credentials and keys, remove DNS records and firewall rules, wipe disks, cancel billing, and update documentation.

  • Linux Server Hardening Checklist for Django

    Harden a Linux server running Django: SSH keys, firewall rules, automatic security updates, least-privilege users, systemd sandboxing, fail2ban, and audit checks.

Fix it

Errors and symptoms, each traced to a cause and a fix.

Learning paths through this topic

Related topics