Dify self-hosted: run the LLMOps platform on your VPS
Running Dify self-hosted on your own VPS turns it into a private LLMOps platform for building AI apps (visual workflows, RAG pipelines, chatbots, knowledge bases) without the per-seat fees of the cloud version and without your data leaving your server.
This guide covers what Dify is, why the self-hosted path beats the cloud version for most teams, and how to get it running on a VPS in about 20 minutes.
What Dify does
Dify is an open-source platform for building AI-powered applications. Think of it as a workbench for chatbots, document analysis tools, AI-assisted workflows, and internal Q&A systems, without writing a ton of orchestration code.
The visual workflow builder is the centerpiece. Drag and drop nodes to create AI pipelines: take user input, send to an LLM, pull context from a knowledge base, run logic, return a response. Like Zapier or n8n, but purpose-built for AI applications.
Why self-host Dify
Dify offers a cloud version, but Dify self-hosted gives you clear advantages:
- No per-seat pricing. Cloud charges per team member. Self-hosted, everyone uses it free.
- Your data stays on your server. Documents, knowledge bases, conversation logs, user data never leave your VPS.
- Use your own API keys. Connect directly to Anthropic, OpenAI, or any provider. You pay the provider directly, no markup.
- No usage limits. Cloud has limits on message credits, file uploads, storage. Self-hosted has none.
- Run local models. Connect Dify to Ollama on the same server for fully private inference. Nothing leaves your machine.
What you can build with Dify self-hosted
Dify is a toolkit for several types of AI apps:
Knowledge base chatbots (RAG)
Upload documentation, support articles, product manuals, or internal wiki. Dify chunks content, stores it in a vector database, and lets you build chatbots that answer questions using your actual data instead of hallucinating.
AI workflows
Chain multiple LLM calls, conditional logic, HTTP requests, and code execution into visual workflows. Example: receive a customer email, classify intent, draft a response, check a database for order status, send the reply, all defined visually.
Internal tools
Build AI-powered tools for your team: document summarizers, code reviewers, data extractors, translation tools, content generators. Each tool gets its own interface and can be shared with team members.
Customer-facing chatbots
Create embeddable chat widgets for your website that answer questions from your knowledge base. Dify handles conversation flow, context retrieval, and response generation.
VPS requirements for Dify self-hosted
Dify runs several containers (API server, web frontend, worker, database, Redis, vector store), so it needs decent resources:
| Workload | RAM | vCPUs | Storage |
|---|---|---|---|
| Development/testing | 4 GB | 2 | 20 GB |
| Small team (2-5 users) | 8 GB | 4 | 40 GB |
| Production | 16 GB+ | 4+ | 80 GB+ |
Storage requirements grow with knowledge base size. Uploading thousands of documents? Plan accordingly.
Installing Dify self-hosted on your VPS
Dify uses Docker Compose:
- Deploy an Ubuntu VPS with at least 8 GB RAM
- Install Docker and Docker Compose
- Clone the Dify repository
- Copy the example environment file and configure settings
- Run
docker compose up -d - Access the web interface at
http://your-vps-ip:80 - Create your admin account during first login
Initial setup takes 15-20 minutes. After that, everything is managed through the web UI.
Connecting AI providers to Dify
Dify works with most major providers out of the box:
- Anthropic (Claude models)
- OpenAI (GPT models)
- Google (Gemini)
- Local models via Ollama, LocalAI, or Xinference
Add API keys through Dify settings. Configure multiple providers and switch between them per task. Cheaper model for simple classification, more capable model for complex generation.
Dify self-hosted vs building it yourself
You could build RAG pipelines and AI workflows with LangChain, LlamaIndex, or raw API calls. Dify doesn’t do anything technically impossible without it.
But it saves weeks of engineering. Visual workflow builder, vector database management, prompt versioning, conversation logging, user management, all built in. For most teams, Dify gives you on day one what would otherwise take weeks to build.
Dify vs n8n
Both are workflow tools, different purposes. n8n is general-purpose automation connecting to hundreds of services. It can do AI, but that’s not its focus. Dify is built ground-up for AI applications with better RAG, a purpose-built prompt IDE, and native model management.
Need to connect Slack to Google Sheets with some AI sprinkled in? n8n. Building a serious AI app with knowledge bases, multi-step reasoning, and conversation management? Dify.
Some teams run both: Dify for AI-heavy workflows, n8n for everything else.
Production tips for Dify self-hosted
- Put it behind a reverse proxy. Nginx with SSL from Let’s Encrypt. Don’t expose Dify directly on port 80.
- Set up regular backups. Dify stores data in PostgreSQL and Redis. Back up the database regularly, especially with complex workflows.
- Monitor disk space. Knowledge bases with many documents and embeddings grow fast.
- Keep it updated. Dify ships new features and fixes frequently. Pull latest images regularly.
Deploy a Linux VPS with 8 GB+ RAM and get Dify self-hosted running in 20 minutes. Pick any of our six data center locations for the best performance near your users.