This guide covers Dify configuration options for customizing your deployment.
# Application mode
MODE=api
# Console API URL
CONSOLE_API_URL=https://dify.example.com
# Console Web URL
CONSOLE_WEB_URL=https://dify.example.com
# Service API URL
SERVICE_API_URL=https://dify.example.com/api
# Application secret key
SECRET_KEY=your-secret-key-here
# PostgreSQL
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=dify
DB_PASSWORD=your-secure-password
DB_DATABASE=dify
# Connection pool
DB_POOL_SIZE=30
DB_POOL_MAX_OVERFLOW=10
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your-secure-password
REDIS_DB=0
# OpenAI
OPENAI_API_KEY=sk-...
OPENAI_API_BASE=https://api.openai.com/v1
# Anthropic
ANTHROPIC_API_KEY=sk-ant-...
# Azure OpenAI
AZURE_OPENAI_API_KEY=...
AZURE_OPENAI_ENDPOINT=...
# Local models (Ollama)
OLLAMA_BASE_URL=http://localhost:11434
Configure custom models in the Dify console:
# Temperature (creativity)
temperature: 0.7
# Max tokens
max_tokens: 4096
# Top P (nucleus sampling)
top_p: 0.9
# Frequency penalty
frequency_penalty: 0.5
# Presence penalty
presence_penalty: 0.5
# Vector store type
VECTOR_STORE=weaviate
# Weaviate configuration
WEAVIATE_ENDPOINT=http://localhost:8080
WEAVIATE_API_KEY=your-api-key
# Alternative: Milvus
MILVUS_URI=http://localhost:19530
# Alternative: Chroma
CHROMA_HOST=localhost
CHROMA_PORT=8000
# File upload limits
FILE_UPLOAD_SIZE_LIMIT=100MB
# Supported formats
SUPPORTED_EXTENSIONS=pdf,docx,txt,md,pptx,xlsx
# Chunking settings
CHUNK_SIZE=1000
CHUNK_OVERLAP=200
# Worker count
WORKER_COUNT=2
# Queue configuration
CELERY_BROKER_URL=redis://localhost:6379/1
# Task timeout
TASK_TIMEOUT=3600
# Log level
LOG_LEVEL=INFO
# Log format
LOG_FORMAT=json
# Log output
LOG_OUTPUT=file
LOG_FILE=/var/log/dify/app.log
# Gunicorn workers
API_WORKERS=4
# Worker connections
API_WORKER_CONNECTIONS=1000
# Request timeout
API_TIMEOUT=120
# Connection pool
DB_POOL_SIZE=30
DB_POOL_MAX_OVERFLOW=10
DB_POOL_TIMEOUT=30
# Query timeout
DB_QUERY_TIMEOUT=30
# CORS settings
CORS_ORIGINS=https://your-domain.com
# Rate limiting
RATE_LIMIT_ENABLED=true
RATE_LIMIT_REQUESTS=100
RATE_LIMIT_WINDOW=60
# Session configuration
SESSION_COOKIE_SECURE=true
SESSION_COOKIE_HTTPONLY=true
SESSION_COOKIE_SAMESITE=Lax
Any questions?
Feel free to contact us. Find all contact information on our contact page.