Dify deployment: Docker Compose + reverse proxy
Open-source LLM app platform: workflows, RAG, agents and model management. Deployed from the official repo's docker directory.
In short: Open-source LLM app platform: workflows, RAG, agents and model management. Deployed from the official repo's docker directory. A multi-service stack: this page shows the official install commands.
- Server
- Official: CPU ≥ 2 cores, RAM ≥ 4 GiB; Docker Compose v2.35.0+ and OpenSSL; our generic suggestion: 2 vCPU / 4 GB RAM and up
- Ports
- 80 (Bundled Nginx entry (configurable in .env))
- Install
- Official steps
- Official source
- github.com/langgenius/dify/blob/main/README.md
- Last verified
- 2026-11-13 · Official method
Overview & official links
- About
- Open-source LLM app platform: workflows, RAG, agents and model management. Deployed from the official repo's docker directory.
- Repository
- github.com/langgenius/dify
- Docs
- docs.dify.ai
- Deploy source
- github.com/langgenius/dify/blob/main/README.md checked 2026-11-13
- Verification
- Official method Complex stack: we show the official commands as-is, not modified or run by us
- Ports
80Bundled Nginx entry (configurable in .env)
Server requirements
Official requirements
CPU ≥ 2 cores, RAM ≥ 4 GiB; Docker Compose v2.35.0+ and OpenSSL. — source
Suggested VPS size
2 vCPU / 4 GB RAM and up, Debian 12 / Ubuntu 24.04 with Docker.
Generic suggestion, not official.
Install (official steps)
git clone --depth 1 https://github.com/langgenius/dify.git /opt/dify cd /opt/dify/docker cp .env.example .env openssl rand -hex 32 # 填到 .env 的 DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN docker compose up -d docker compose ps --all
- Dify ships its own Nginx on 80/443; change the exposed ports in .env (see .env.example) if the host already runs Nginx.
- Open http://SERVER/install to finish setup.
Reverse proxy & HTTPS
The app listens on 127.0.0.1:80; expose it with Nginx or Caddy over HTTPS. This app needs WebSocket; the config handles the Upgrade header. For rate limiting, caching and more, use the nginx.cc generator.
# Dify 反向代理 / reverse proxy — generated by deploy.cc
# 把 example.com 换成你的域名,证书路径按实际修改(certbot / acme.sh 签发)。
# Replace example.com and the certificate paths. More options: https://nginx.cc/zh/gen
# 放到 /etc/nginx/conf.d/<name>.conf,然后 nginx -t && systemctl reload nginx
map $http_upgrade $connection_upgrade_dify {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
location /.well-known/acme-challenge/ {
root /var/www/html;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on; # nginx < 1.25.1: 删除此行,改为 listen 443 ssl http2;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
client_max_body_size 100m;
location / {
proxy_pass http://127.0.0.1:80;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade_dify;
proxy_read_timeout 3600s;
proxy_buffering off; # 流式输出 / streaming responses
}
}
Or Caddy (automatic certificates)
# Dify — Caddyfile (deploy.cc). Caddy 会自动申请 HTTPS 证书 / automatic HTTPS
example.com {
reverse_proxy 127.0.0.1:80
}
Update, backup & uninstall
cd /opt/dify && git pull cd docker && docker compose pull && docker compose up -d
For backup and removal follow the official docs; volume locations depend on the official compose.
FAQ
What is Dify?
Open-source LLM app platform: workflows, RAG, agents and model management. Deployed from the official repo's docker directory. Repository: https://github.com/langgenius/dify
What server do I need for Dify?
Official: CPU ≥ 2 cores, RAM ≥ 4 GiB; Docker Compose v2.35.0+ and OpenSSL; our generic suggestion: 2 vCPU / 4 GB RAM and up (source: https://github.com/langgenius/dify/blob/main/README.md)
Which ports does Dify use?
80 (Bundled Nginx entry (configurable in .env))
How do I update Dify?
cd /opt/dify && git pull && cd docker && docker compose pull && docker compose up -d. Back up and read the release notes before major upgrades.
Plain-text version (for copying or AI tools): /en/apps/dify.md
Related apps
Self-hosted ChatGPT-style AI interface for Ollama and OpenAI-compatible APIs.
AI & automationConfig-checked OllamaRun large language models locally with an HTTP API.
AI & automationConfig-checked LobeHub(Lobe Chat)Open-source AI chat / agent platform (formerly Lobe Chat). The official compose bundles PostgreSQL, Redis, RustFS, SearXNG and more.
AI & automationOfficial method NextChatLightweight web client for ChatGPT, Gemini and other models (formerly ChatGPT-Next-Web).
AI & automationRun-tested n8nVisual workflow automation with many integrations and AI agents; a self-hosted Zapier alternative.
AI & automationConfig-checked