How to Deploy Dify - Open-Source LLM Application Development Platform

Updated on 04 August, 2026
Deploy Dify on a Linux server using Docker Compose with Nginx, Let’s Encrypt HTTPS, model provider integration, and a working AI chatbot.
How to Deploy Dify - Open-Source LLM Application Development Platform header image

Dify is an open-source platform for building Large Language Model (LLM) applications. Its visual interface combines AI workflow design, Retrieval-Augmented Generation (RAG) pipelines, agent capabilities, model management, and observability tools. Dify supports hundreds of proprietary and open-source LLMs through providers such as OpenAI, Anthropic, and self-hosted solutions.

This article explains how to deploy Dify on a Linux server using Docker Compose with the bundled Nginx reverse proxy and HTTPS certificate provisioning through Let's Encrypt. It covers directory setup, environment configuration, model provider integration, and demonstrates the platform with a working chatbot application.

Prerequisites

Before you begin, you need to:

Set Up the Directory Structure, Configuration, and Environment Variables

Dify ships a complete Docker Compose stack with an example environment file. Download the release and customize the environment variables for your domain and Let's Encrypt configuration.

  1. Download and extract the Dify release.

    console
    $ curl -sL https://github.com/langgenius/dify/archive/refs/tags/1.14.1.tar.gz | tar -xz
    
  2. Rename the extracted directory.

    console
    $ mv dify-1.14.1 ~/dify
    
  3. Navigate to the docker directory.

    console
    $ cd ~/dify/docker
    
  4. Copy the example environment file.

    console
    $ cp .env.example .env
    
  5. Generate a strong secret key and write it to the .env file.

    console
    $ sed -i "s|^SECRET_KEY=.*|SECRET_KEY=$(openssl rand -base64 42)|" .env
    
  6. Open the .env file to configure the domain and Certbot settings.

    console
    $ nano .env
    
  7. Locate the following variables and update their values. Replace dify.example.com with your domain name and admin@example.com with your email address. CERTBOT_DOMAIN and CERTBOT_EMAIL are not present in the default file, so add them as new lines.

    ini
    NGINX_SERVER_NAME=dify.example.com
    NGINX_SSL_CERT_FILENAME=fullchain.pem
    NGINX_SSL_CERT_KEY_FILENAME=privkey.pem
    NGINX_ENABLE_CERTBOT_CHALLENGE=true
    CONSOLE_API_URL=https://dify.example.com
    CONSOLE_WEB_URL=https://dify.example.com
    SERVICE_API_URL=https://dify.example.com
    APP_API_URL=https://dify.example.com
    APP_WEB_URL=https://dify.example.com
    
    CERTBOT_DOMAIN=dify.example.com
    CERTBOT_EMAIL=admin@example.com
    

    Save and close the file.

Deploy with Docker Compose

Dify ships a complete Docker Compose stack with core services and dependent components. The bundled Docker Compose file is over 1,200 lines and includes PostgreSQL, Redis, Weaviate vector store, and Nginx. This article uses Dify version 1.14.1. The deployment process runs in two stages: the first starts services on HTTP, and the second provisions the Let's Encrypt certificate through Certbot and enables HTTPS.

  1. Start the Dify stack in detached mode.

    console
    $ docker compose up -d
    

    Nginx serves the application on port 80 and exposes the ACME challenge path for HTTP-01 verification.

  2. Verify all containers are running.

    console
    $ docker compose ps -a
    

    The output displays all Dify services in an Up state, with a healthy status shown for the services that define a health check, such as db_postgres, redis, and sandbox.

  3. Add the Certbot container to the running stack.

    console
    $ docker compose --profile certbot up -d certbot
    

    The Certbot container starts and waits for the certificate provisioning command.

  4. Provision the Let's Encrypt certificate by running the helper script inside the Certbot container.

    console
    $ docker compose exec certbot /bin/sh /update-cert.sh
    

    Certbot performs the HTTP-01 challenge and stores the certificate files under volumes/certbot/conf/live/<domain>/.

  5. Enable HTTPS in the .env file.

    console
    $ sed -i "s|^NGINX_HTTPS_ENABLED=.*|NGINX_HTTPS_ENABLED=true|" .env
    

    NGINX_HTTPS_ENABLED is now set to true in the .env file.

  6. Recreate the Nginx container so it picks up the new HTTPS configuration and the provisioned certificate.

    console
    $ docker compose --profile certbot up -d --no-deps --force-recreate nginx
    

For more information on managing a Docker Compose stack, see the How to Use Docker Compose article.

Access and Configure Dify

After deployment, complete the administrator setup and connect a model provider to enable AI applications.

  1. Replace dify.example.com with your configured domain and open https://dify.example.com/install in a browser.

  2. Enter the email address, username, and password for the administrator account, then click Set up.

    Dify administrator account setup form on first launch

  3. Log in at https://dify.example.com/signin with the email address and password you set in the previous step.

  4. Click your profile avatar in the top-right corner, select Settings, then choose Model Provider from the left sidebar.

  5. Locate your preferred provider in the catalog (such as OpenAI, Anthropic, DeepSeek, or others) and click Install. The Plugin Daemon downloads the provider plugin from the Dify Marketplace on demand.

  6. Add your API key on the provider configuration panel and click Save.

    Dify model provider credential panel with the API key field

  7. Confirm that the saved provider appears under the configured providers list with at least one chat model available.

Application Use Case

Dify offers multiple app types including Chatbot, Workflow, Chatflow, Agent, and Text Generator. This section builds a customer support assistant using a chatflow, which combines conversation memory with a visual node editor.

  1. Open the Studio tab in the top navigation, then click Create from Blank.

  2. Select Chatflow, name the application Support Assistant, set an icon and description, and click Create. The canvas opens with three pre-connected nodes: Start, LLM, and Answer.

  3. Click the LLM node to configure it.

  4. Select your chat model from the Model dropdown (for example, gpt-4o or claude-sonnet-5).

  5. Add a system prompt under the SYSTEM field.

    text
    You are a customer support agent for a SaaS product. Answer questions about billing, installation, and integrations in a clear, concise tone. Refer the user to the documentation when a question falls outside your knowledge.
    
  6. Confirm the MEMORY toggle is enabled with a WINDOW SIZE of 10 to maintain conversation context.

  7. Click Publish in the top-right corner, then choose Publish Update to make the chatflow available.

    Dify chatflow Start, LLM, and Answer nodes connected on the canvas

  8. Click Preview in the top-right corner and send a test message such as The platform charged the subscription twice this month. Can you help with a refund?.

  9. Verify that the assistant returns a coherent response that addresses the billing concern.

  10. Click the Publish dropdown and select Run App to open the standalone chat interface.

    Dify Support Assistant standalone chat interface

Conclusion

You have deployed Dify on a Linux server using Docker Compose with the bundled Nginx reverse proxy and HTTPS through Let's Encrypt. The deployment hosts a working chatbot that sends user questions to your configured model provider and returns memory-aware responses. For advanced features including RAG pipelines, agents, and workflow automation, refer to the official Dify documentation.

Comments