
Dify
Open-source LLM app development platform for building AI workflows, RAG pipelines, and chatbots
Deploy Dify in 3 Steps
Connect Your VPS
Add your server credentials to Server Compass
Select Dify
Choose from our template library
Deploy & Configure
Fill in settings and click Deploy
Manual Dify Setup
For terminal enthusiasts: deploy Dify manually with these simple steps.
SSH into Your Server
Launch your preferred terminal and connect to your VPS using SSH.
# Log into your server
ssh root@<your-server-ip>
# If using key-based auth
ssh -i ~/.ssh/my-key root@<your-server-ip>First time? Docker not installed? Run: curl -fsSL https://get.docker.com | sh
Create Working Directory
Prepare a directory for your application files and configuration.
# Create and navigate to project directory
mkdir -p ~/apps/dify
cd ~/apps/difyConfigure Your Containers
Create the Docker Compose configuration file with these contents:
services:
api:
image: langgenius/dify-api:latest
environment:
- MODE=api
- SECRET_KEY=<your-secret-key>
- DB_USERNAME=postgres
- DB_PASSWORD=<your-db-password>
- DB_HOST=db
- DB_PORT=5432
- DB_DATABASE=dify
- REDIS_HOST=redis
- REDIS_PORT=6379
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=/app/api/storage
- VECTOR_STORE=weaviate
- WEAVIATE_ENDPOINT=http://weaviate:8080
- SANDBOX_API_KEY=<your-sandbox-key>
- SANDBOX_HOST=http://sandbox:8194
volumes:
- dify_storage:/app/api/storage
restart: unless-stopped
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
worker:
image: langgenius/dify-api:latest
environment:
- MODE=worker
- SECRET_KEY=<your-secret-key>
- DB_USERNAME=postgres
- DB_PASSWORD=<your-db-password>
- DB_HOST=db
- DB_PORT=5432
- DB_DATABASE=dify
- REDIS_HOST=redis
- REDIS_PORT=6379
- STORAGE_TYPE=local
- STORAGE_LOCAL_PATH=/app/api/storage
- VECTOR_STORE=weaviate
- WEAVIATE_ENDPOINT=http://weaviate:8080
volumes:
- dify_storage:/app/api/storage
restart: unless-stopped
depends_on:
- api
web:
image: langgenius/dify-web:latest
environment:
- CONSOLE_API_URL=
- APP_API_URL=
restart: unless-stopped
nginx:
image: nginx:latest
ports:
- "80:80"
entrypoint: sh
command:
- -c
- |
cat > /etc/nginx/conf.d/default.conf << 'CONF'
server {
listen 80;
client_max_body_size 15M;
location /api { proxy_pass http://api:5001; proxy_set_header Host $$host; proxy_set_header X-Real-IP $$remote_addr; }
location /console/api { proxy_pass http://api:5001; proxy_set_header Host $$host; }
location /v1 { proxy_pass http://api:5001; proxy_set_header Host $$host; }
location /files { proxy_pass http://api:5001; proxy_set_header Host $$host; }
location / { proxy_pass http://web:3000; proxy_set_header Host $$host; }
}
CONF
nginx -g 'daemon off;'
restart: unless-stopped
depends_on:
- api
- web
db:
image: postgres:15-alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=<your-db-password>
- POSTGRES_DB=dify
volumes:
- dify_db:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d dify"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
redis:
image: redis:6-alpine
volumes:
- dify_redis:/data
restart: unless-stopped
weaviate:
image: semitechnologies/weaviate:1.27.0
environment:
- QUERY_DEFAULTS_LIMIT=25
- AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true
- PERSISTENCE_DATA_PATH=/var/lib/weaviate
- DEFAULT_VECTORIZER_MODULE=none
- CLUSTER_HOSTNAME=node1
volumes:
- dify_weaviate:/var/lib/weaviate
restart: unless-stopped
sandbox:
image: langgenius/dify-sandbox:latest
environment:
- API_KEY=<your-sandbox-key>
- GIN_MODE=release
restart: unless-stopped
volumes:
dify_storage:
dify_db:
dify_redis:
dify_weaviate:
PORTHost port to expose(default: 80)SECRET_KEYApp secretDB_PASSWORDDatabase passwordSANDBOX_KEYSandbox keyDeploy with Docker Compose
Launch the application stack using Docker Compose.
# Deploy the application
docker compose up -d
# Check container health
docker compose ps
# Monitor logs
docker compose logs -f --tail=100Open Required Ports
Enable external access by opening the necessary port.
# Allow the application port through firewall
sudo ufw allow 80/tcp
sudo ufw reload
# Access your app at:
# http://your-server-ip:80There's an easier way. Meet Server Compass.
Deploy Dify without touching the command line. Server Compass gives you a clean UI for one-click deployments.
- Intuitive dashboard
- Deploy in 3 minutes
- Free SSL included
- Blue-green deploys
- Real-time logs
- Version history
After Deployment
After deploying Dify with Server Compass, complete these steps to finish setup
Open the Dify URL in your browser
Create your admin account
Configure model providers (OpenAI, Anthropic, etc.)
Create your first AI application
Need help? Check out our documentation for detailed guides.
Dify FAQ
Common questions about self-hosting Dify
How do I deploy Dify with Server Compass?
Simply download Server Compass, connect to your VPS, and select Dify from the templates list. Fill in the required configuration and click Deploy. The entire process takes under 3 minutes.
What are the system requirements for Dify?
Dify requires a minimum of 4096MB RAM. We recommend a VPS with at least 8192MB RAM for optimal performance. Any modern Linux server with Docker support will work.
Can I migrate my existing Dify data?
Yes! Server Compass provides volume mapping that allows you to import existing data. You can also use standard Dify backup and restore procedures.
How do I update Dify to the latest version?
Server Compass makes updates easy. Simply click the Update button in your deployment dashboard, and the latest Dify image will be pulled and deployed with zero downtime.
Is Dify free to self-host?
Dify is open-source software. You only pay for your VPS hosting (typically $5-20/month) and optionally Server Compass ($29 one-time). No subscription fees or per-seat pricing.
Related Templates
View all Development
PocketBase
Open-source backend in a single file with realtime database, auth, and file storage

Appwrite
Open-source backend-as-a-service - self-hosted Firebase alternative

Parse Server
Open-source backend framework with dashboard

Supabase
Full Supabase self-hosted with Kong, GoTrue Auth, Realtime, and Studio
Ready to Self-Host Dify?
Download Server Compass and deploy Dify to your VPS in under 3 minutes. No Docker expertise required.
Download Server Compass