Back to all templates
Dify logo

Dify

Development4096MB+ RAM

Open-source LLM app development platform for building AI workflows, RAG pipelines, and chatbots

aillmworkflowragchatbotlangchain-alternative

Deploy Dify in 3 Steps

1

Connect Your VPS

Add your server credentials to Server Compass

2

Select Dify

Choose from our template library

3

Deploy & Configure

Fill in settings and click Deploy

No Docker knowledge required
Step-by-step deployment guide

Deploy Dify on a VPS with Server Compass

Use the Dify template in Server Compass to deploy a self-hosted LLM app development platform on your VPS, then verify the first-run web UI in a browser.

About 10 minutesBrowser verified
1
Step 1

Open the server Apps tab

Select the tutorial-vps VPS, open the Apps tab, and start a new app deployment. Keep sensitive server details hidden before capturing or sharing screenshots.

Server Compass Apps tab before creating a Dify app
2
Step 2

Choose an app template

Click New App and choose the template deployment path so Server Compass can load the built-in catalog.

Choosing to deploy an app from a Server Compass template
3
Step 3

Search for Dify

Use the template picker search to find Dify in the Server Compass template catalog.

Searching for Dify in the Server Compass template picker
4
Step 4

Select the Dify template

Choose the Dify template. Server Compass fills the API, worker, web, nginx, Postgres, Redis, Weaviate, and sandbox services with generated secrets and persistent volumes.

Dify template selected in Server Compass
5
Step 5

Review the Dify settings

Confirm the app name and compose services. In this run, the app was named dify-demo and used host port 3001.

Reviewing Dify project settings and compose services
6
Step 6

Deploy Dify

Review the generated compose settings, confirm the web port is available, keep generated application/database/sandbox secrets hidden, and click Deploy Now.

Reviewing Dify environment variables and port before deployment
7
Step 7

Watch the deployment progress

Keep the deployment modal open while Server Compass uploads the compose file, pulls the Dify image, starts the container, and verifies the stack.

Server Compass deploying the Dify template on the VPS
8
Step 8

Confirm Dify is running

After deployment finishes, return to the Apps tab and confirm the Dify app is marked Running with its application URL available.

Dify template running in the Server Compass Apps tab
9
Step 9

Open Dify in the browser

Click Open Application or open the application URL in a browser. The Dify first-run screen confirms the platform is reachable and ready for the first admin account.

The deployed Dify first-run screen loaded in a browser

After Dify Opens

  • Register the first Dify user promptly; the first registered user becomes admin.
  • Configure model providers such as OpenAI, Anthropic, or local providers before production use.
  • Review workspace, API key, and user access settings before inviting teammates.
  • Add a domain and HTTPS before exposing the Dify console outside a private network.
  • Back up the Dify storage, Postgres, Redis, and Weaviate volumes before relying on production workflows.

Verified Result

The Dify web UI loaded successfully in a browser.

Dify deployment questions

What does the Dify template deploy?

It deploys Dify API, worker, web, nginx, Postgres, Redis, Weaviate, and sandbox services with persistent storage and generated secrets.

Which port did the tutorial use?

The tutorial used host port 3001, which maps to the Dify nginx web entrypoint on container port 80.

Why does the browser verification stop at the first web UI screen?

A fresh Dify deployment is considered reachable when the first-run setup screen loads. Model-provider configuration, workspace policy, and app publishing depend on your own production setup.

Should this become a blog post?

No. The deployment guide should live on the Dify template detail page and be linked from the reusable template deployment docs page.

Manual Deployment Guide

Manual Dify Setup

For terminal enthusiasts: deploy Dify manually with these simple steps.

1

SSH into Your Server

Launch your preferred terminal and connect to your VPS using SSH.

terminal
# 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

2

Create Working Directory

Prepare a directory for your application files and configuration.

terminal
# Create and navigate to project directory
mkdir -p ~/apps/dify
cd ~/apps/dify
3

Configure Your Containers

Create the Docker Compose configuration file with these contents:

docker-compose.yml
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:
Environment Configuration
PORTHost port to expose(default: 80)
SECRET_KEYApp secret
DB_PASSWORDDatabase password
SANDBOX_KEYSandbox key
4

Deploy with Docker Compose

Launch the application stack using Docker Compose.

terminal
# Deploy the application
docker compose up -d

# Check container health
docker compose ps

# Monitor logs
docker compose logs -f --tail=100
5

Open Required Ports

Enable external access by opening the necessary port.

terminal
# Allow the application port through firewall
sudo ufw allow 80/tcp
sudo ufw reload

# Access your app at:
# http://your-server-ip:80
Skip the Terminal

There'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
Download Server Compass$29 one-time • Lifetime license

After Deployment

After deploying Dify with Server Compass, complete these steps to finish setup

1

Open the Dify URL in your browser

2

Create your admin account

3

Configure model providers (OpenAI, Anthropic, etc.)

4

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.

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