This guide installs self-hosted Dify 1.20.0 on an Ubuntu 24.04 VPS with Docker Compose, pinned tags for every image, rotated production secrets, and Caddy 2.11.9 handling automatic HTTPS. The setup disables the bundled nginx container, closes port 5003 on the plugin daemon that the default Compose file publishes to the host, and covers verification, backups, and upgrades. All commands, host ports, and the initial admin setup were tested on December 3, 2026 on a clean Ubuntu 24.04.5 LTS ( amd64 ) VM.
If you are still deciding between Dify and n8n before spinning up a server, read Dify vs n8n on a VPS: when to choose each one .
Versions used
Component Version Source
Dify ( api , web , agent_backend , local_sandbox ) 1.20.0 (2026-11-18) Dify releases
Dify Plugin Daemon 0.6.15-local docker/docker-compose.yaml
Dify Sandbox 0.2.15 docker/docker-compose.yaml
Weaviate 1.39.13 docker/docker-compose.yaml
PostgreSQL 15-alpine ( 15.20 tested) docker/docker-compose.yaml
Redis 6-alpine ( 6.2.24 tested)…