使用 Docker 快速部署 open-webui 服务。

docker-compose.yml

services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
    container_name: open-webui
    volumes:
      - ./data:/app/backend/data
    ports:
      - 8080:8080
    environment:
      - 'WEBUI_SECRET_KEY=123456789'
      # openai 配置
      - 'OPENAI_API_BASE_URL=https://api.openai.com/v1'
      - 'OPENAI_API_KEY=sk-xxxx'
      # 启用openai画图
      - 'ENABLE_IMAGE_GENERATION=true'
      - 'IMAGE_GENERATION_ENGINE=openai'
      # 开启注册登录功能
      - 'WEBUI_AUTH=true'
      - 'ENABLE_SIGNUP=true'
      - 'DEFAULT_USER_ROLE=user'
      # 忽略部分模型(关闭)
      - 'ENABLE_MODEL_FILTER=false'
      - 'MODEL_FILTER_LIST=tts-az-1;tts-1'
      - 'WEBUI_NAME=OiChat'
      # 默认模型
      - 'DEFAULT_MODELS=gpt-4o' 
    restart: unless-stopped

nginx 配置


#PROXY-START/

location / {
    proxy_pass http://127.0.0.1:8501; 
    proxy_read_timeout 600; 
    proxy_set_header Host $host; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header REMOTE-HOST $remote_addr; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    proxy_http_version 1.1; 
    chunked_transfer_encoding on; # 开启分块传输编码
    tcp_nopush on; # 开启TCP NOPUSH选项,禁止Nagle算法
    tcp_nodelay on; # 开启TCP NODELAY选项,禁止延迟ACK算法
    keepalive_timeout 600; # 设定keep-alive超时时间为300秒
    add_header Strict-Transport-Security "max-age=31536000"; 
    add_header Cache-Control no-cache; 
}

#PROXY-END/