{"id":32226,"date":"2026-07-22T10:59:56","date_gmt":"2026-07-22T08:59:56","guid":{"rendered":"https:\/\/contabo.com\/blog\/?p=32226"},"modified":"2026-07-22T12:12:43","modified_gmt":"2026-07-22T10:12:43","slug":"self-host-dify-vps-docker","status":"publish","type":"post","link":"https:\/\/contabo.com\/blog\/self-host-dify-vps-docker\/","title":{"rendered":"How to Self-Host Dify on a VPS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Dify is an open-source platform for building LLM applications \u2014 a visual workflow editor, RAG pipeline, and agent builder in one interface. It self-hosts via Docker Compose on a standard VPS: clone the repo, copy the env file, run docker compose up, and you have a working instance. Budget at least 2 vCPUs and 4 GB RAM, more if you plan to index large document sets for retrieval.<\/p>\n\n\n\n<h2 id=\"h-what-is-dify\" class=\"wp-block-heading\">What Is Dify?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Dify is an open-source LLM application development platform that combines a visual workflow canvas, a built-in retrieval-augmented generation (RAG) pipeline, <a href=\"https:\/\/contabo.com\/blog\/self-hosted-ai-orchestration-platforms\/\">agent orchestration<\/a>, and prompt management in a single tool. Instead of writing separate scripts to chain a document lookup, an LLM call, and a formatted response together, you build the pipeline visually and Dify handles the plumbing \u2014 vector indexing, model routing, and API exposure for whatever you build.<\/p>\n\n\n\n<h2 id=\"h-why-self-host-dify-instead-of-dify-cloud\" class=\"wp-block-heading\">Why Self-Host Dify Instead of Dify Cloud?<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Data privacy: documents, prompts, and API keys stay on your server instead of a vendor&#8217;s infrastructure.<\/li>\n\n\n\n<li>No per-seat or per-credit pricing: your only recurring cost is the VPS itself.<\/li>\n\n\n\n<li>Full model flexibility: connect any API-based model (OpenAI, Anthropic, DeepSeek) or a locally hosted model via Ollama.<\/li>\n\n\n\n<li><a href=\"https:\/\/gdpr-info.eu\/\" rel=\"nofollow\">GDPR<\/a>-friendly: deploying on an <a href=\"https:\/\/contabo.com\/en\/locations\/europe\/\">EU-based VPS <\/a>keeps document and prompt data inside the geographic boundaries many compliance regimes require.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"h-vps-requirements-for-dify\" class=\"wp-block-heading\">VPS Requirements for Dify<\/h2>\n\n\n\n<div class=\"dify-vps-requirements\">\n  <style>\n    .dify-vps-requirements {\n      margin: 2rem 0;\n      font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n    }\n    .dify-vps-requirements__intro {\n      font-size: 1rem;\n      line-height: 1.6;\n      color: #2b2b2b;\n      margin: 0 0 1rem;\n    }\n    .dify-vps-requirements table {\n      width: 100%;\n      border-collapse: collapse;\n      border: 1px solid #dcdfe3;\n      border-radius: 8px;\n      overflow: hidden;\n      font-size: 0.95rem;\n      line-height: 1.5;\n    }\n    .dify-vps-requirements caption {\n      text-align: left;\n      font-weight: 600;\n      font-size: 1rem;\n      padding: 0 0 0.5rem;\n      color: #1a1a1a;\n    }\n    .dify-vps-requirements thead th {\n      background: #365f91;\n      color: #ffffff;\n      text-align: left;\n      font-weight: 600;\n      padding: 0.75rem 1rem;\n    }\n    .dify-vps-requirements tbody td,\n    .dify-vps-requirements tbody th {\n      padding: 0.7rem 1rem;\n      border-bottom: 1px solid #eceff2;\n      text-align: left;\n      vertical-align: top;\n    }\n    .dify-vps-requirements tbody th {\n      font-weight: 600;\n      color: #1a1a1a;\n      white-space: nowrap;\n    }\n    .dify-vps-requirements tbody tr:last-child td,\n    .dify-vps-requirements tbody tr:last-child th {\n      border-bottom: none;\n    }\n    .dify-vps-requirements tbody tr:nth-child(even) {\n      background: #f7f9fb;\n    }\n    .dify-vps-requirements__source {\n      margin-top: 0.5rem;\n      font-size: 0.85rem;\n      color: #6b7280;\n    }\n    @media (max-width: 600px) {\n      .dify-vps-requirements table,\n      .dify-vps-requirements thead,\n      .dify-vps-requirements tbody,\n      .dify-vps-requirements tr {\n        display: block;\n        width: 100%;\n      }\n      .dify-vps-requirements thead { display: none; }\n      .dify-vps-requirements tbody tr {\n        border: 1px solid #eceff2;\n        border-radius: 8px;\n        margin-bottom: 0.75rem;\n        padding: 0.5rem 0.75rem;\n      }\n      .dify-vps-requirements tbody td,\n      .dify-vps-requirements tbody th {\n        display: flex;\n        justify-content: space-between;\n        gap: 1rem;\n        border-bottom: none;\n        padding: 0.35rem 0;\n      }\n      .dify-vps-requirements tbody td::before {\n        content: attr(data-label);\n        font-weight: 600;\n        color: #6b7280;\n        flex-shrink: 0;\n      }\n    }\n  <\/style>\n\n  <p class=\"dify-vps-requirements__intro\">\n    <strong>VPS requirements for Dify:<\/strong> a minimum of 2 vCPUs and 2 GB RAM will run Dify, but 4\u20138 GB RAM and 2\u20134 vCPUs are recommended for production use, since embedding generation and vector storage for RAG scale with document volume.\n  <\/p>\n\n  <table itemscope itemtype=\"https:\/\/schema.org\/Table\">\n    <caption>Minimum vs. recommended VPS specs for self-hosting Dify<\/caption>\n    <thead>\n      <tr>\n        <th scope=\"col\">Component<\/th>\n        <th scope=\"col\">Minimum<\/th>\n        <th scope=\"col\">Recommended<\/th>\n      <\/tr>\n    <\/thead>\n    <tbody>\n      <tr>\n        <th scope=\"row\">vCPU<\/th>\n        <td data-label=\"Minimum\">2<\/td>\n        <td data-label=\"Recommended\">2\u20134<\/td>\n      <\/tr>\n      <tr>\n        <th scope=\"row\">RAM<\/th>\n        <td data-label=\"Minimum\">2 GB<\/td>\n        <td data-label=\"Recommended\">4\u20138 GB<\/td>\n      <\/tr>\n      <tr>\n        <th scope=\"row\">Storage<\/th>\n        <td data-label=\"Minimum\">20 GB SSD\/NVMe<\/td>\n        <td data-label=\"Recommended\">40 GB+ NVMe (scales with document volume)<\/td>\n      <\/tr>\n      <tr>\n        <th scope=\"row\">Docker Compose<\/th>\n        <td data-label=\"Minimum\">v2.24.0+<\/td>\n        <td data-label=\"Recommended\">Latest stable<\/td>\n      <\/tr>\n    <\/tbody>\n  <\/table>\n\n  <p class=\"dify-vps-requirements__source\">\n    Specs reflect Dify&#8217;s documented Docker Compose requirements; actual RAM usage scales with indexed document\/embedding volume.\n  <\/p>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Dify runs as a multi-container stack \u2014 the web frontend, API backend, a worker process, Postgres, Redis, and a vector store (Weaviate by default, swappable for Milvus or others) all run alongside each other. That&#8217;s why it needs more headroom than a single-container tool: more RAM if you&#8217;re indexing large document sets for RAG, since embedding generation and vector storage are the heaviest parts of the stack.<\/p>\n\n\n\n<h2 id=\"h-how-to-install-dify-on-a-vps-with-docker-compose\" class=\"wp-block-heading\">How to Install Dify on a VPS with Docker Compose<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Provision a VPS meeting the specs above and update the system: <code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/li>\n\n\n\n<li>Install Docker and the Docker Compose plugin (v2.24.0 or later \u2014 check with docker compose version)<\/li>\n\n\n\n<li>Clone the latest Dify release: git clone &#8211;branch &#8220;<code>$(curl -s https:\/\/api.github.com\/repos\/langgenius\/dify\/releases\/latest | jq -r .tag_name)<\/code>&#8221; https:\/\/github.com\/langgenius\/dify.git<\/li>\n\n\n\n<li>Move into the docker directory: <code>cd dify\/docker<\/code><\/li>\n\n\n\n<li>Copy the example environment file: <code>cp .env.example .env<\/code><\/li>\n\n\n\n<li>Edit <code>.env <\/code>to set your domain, secret key, and any model provider API keys you already have<\/li>\n\n\n\n<li>Start the stack: <code>docker compose up -d<\/code><\/li>\n\n\n\n<li>Confirm every container shows Up or healthy: <code>docker compose ps<\/code> (an Exited status on <code>init_permissions<\/code> is expected and normal)<\/li>\n\n\n\n<li>Open http:\/\/your_server_ip\/install in a browser to create the admin account<\/li>\n\n\n\n<li>Log in at http:\/\/your_server_ip and connect your first model provider<\/li>\n\n\n\n<li>Add a reverse proxy (Caddy or Nginx) with a Let&#8217;s Encrypt certificate to serve Dify over HTTPS before exposing it beyond local testing<\/li>\n<\/ol>\n\n\n\n<h2 id=\"h-why-run-dify-on-a-contabo-vps\" class=\"wp-block-heading\">Why Run Dify on a Contabo VPS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Dify&#8217;s multi-container footprint \u2014 Postgres, Redis, and a vector store running alongside the app \u2014 makes RAM the resource that matters most. A <a href=\"https:\/\/contabo.com\/en\/vps\/\">Cloud VPS 8<\/a> gives you 24 GB of RAM for 14 \u20ac\/month, comfortable headroom for a production Dify instance with room to index a meaningful document set. If your RAG workload grows into large-scale embedding storage, the NVMe-backed <a href=\"https:\/\/contabo.com\/en\/vps-performance\/\">Cloud VPS Performance<\/a> line adds faster disk I\/O for vector search at a similar RAM-per-Euro value. EU data centers keep the documents you&#8217;re indexing \u2014 and the prompts your users send \u2014 inside GDPR-friendly infrastructure.<\/p>\n\n\n\n<h2 id=\"h-faq-self-hosting-dify\" class=\"wp-block-heading\">FAQ: Self-Hosting Dify<\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1784710196577\"><strong class=\"schema-faq-question\">How much RAM does Dify need to self-host?<\/strong> <p class=\"schema-faq-answer\">2 GB is the documented minimum, but 4\u20138 GB is realistic for anything beyond a quick test \u2014 the multi-container stack (Postgres, Redis, vector store, worker) adds up quickly, and embedding generation for RAG document indexing is the heaviest part of the workload.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1784710211174\"><strong class=\"schema-faq-question\">Is Dify free to self-host?<\/strong> <p class=\"schema-faq-answer\">Yes, for internal and commercial use. Dify&#8217;s license is a modified Apache 2.0: you can run it commercially as a backend for your own applications without paying anything. The one restriction is operating it as a multi-tenant hosted service for other customers, which requires written permission from the maintainers.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1784710222577\"><strong class=\"schema-faq-question\">Can I run Dify without a GPU?<\/strong> <p class=\"schema-faq-answer\">Yes, as long as you&#8217;re calling an external model API (OpenAI, Anthropic, DeepSeek) rather than hosting the LLM yourself. A standard CPU-only VPS handles the orchestration, RAG pipeline, and vector search fine. A <a href=\"https:\/\/contabo.com\/en\/gpu-cloud\/\">GPU <\/a>is only needed if you also want to run the language model itself locally via Ollama or a similar tool.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Dify is an open-source platform for building LLM applications \u2014 a visual workflow editor, RAG pipeline, and agent builder in one interface. It self-hosts via Docker Compose on a standard VPS: clone the repo, copy the env file, run docker compose up, and you have a working instance. Budget at least 2 vCPUs and 4 [&hellip;]<\/p>\n","protected":false},"author":78,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[18],"tags":[],"ppma_author":[4285],"class_list":["post-32226","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Jie Guo","author_link":"https:\/\/contabo.com\/blog\/author\/jieguo\/"},"uagb_comment_info":0,"uagb_excerpt":"Dify is an open-source platform for building LLM applications \u2014 a visual workflow editor, RAG pipeline, and agent builder in one interface. It self-hosts via Docker Compose on a standard VPS: clone the repo, copy the env file, run docker compose up, and you have a working instance. Budget at least 2 vCPUs and 4&hellip;","authors":[{"term_id":4285,"user_id":78,"is_guest":0,"slug":"jieguo","display_name":"Jie Guo","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/4e0d981b06988d6d456834e9d55bc9e713e918fa8444325543d14f448154106b?s=96&d=mm&r=g","author_category":"","user_url":"","last_name":"Guo","first_name":"Jie","job_title":"","description":""}],"_links":{"self":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/32226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/comments?post=32226"}],"version-history":[{"count":2,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/32226\/revisions"}],"predecessor-version":[{"id":32249,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/32226\/revisions\/32249"}],"wp:attachment":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media?parent=32226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/categories?post=32226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/tags?post=32226"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=32226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}