Open WebUI

Open WebUI (formerly Ollama WebUI) provides a ChatGPT-like web interface for interacting with local LLMs via Ollama Help. It offers a familiar chat experience with additional features like document upload, image generation, and multi-user support.

Why Open WebUI?

Familiar Interface: ChatGPT-like experience for local models
Document Support: Upload and chat with PDFs, text files
Multi-User: Separate accounts and chat histories
Model Switching: Easily switch between different models
Customization: Themes, prompts, and settings
Privacy: All data stays on your server

Features

Chat Interface

Document Processing (RAG)

Model Management

User Management

Customization

Installation with Docker

Basic Setup

Requires Ollama Help running first.

version: '3.8'

services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    ports:
      - "3000:8080"
    volumes:
      - open-webui-data:/app/backend/data
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    extra_hosts:
      - "host.docker.internal:host-gateway"
    restart: unless-stopped

volumes:
  open-webui-data:

Complete Stack (Ollama + Open WebUI)

version: '3.8'

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    ports:
      - "11434:11434"
    volumes:
      - ollama-data:/root/.ollama
    restart: unless-stopped

  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    ports:
      - "3000:8080"
    volumes:
      - open-webui-data:/app/backend/data
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    depends_on:
      - ollama
    restart: unless-stopped

volumes:
  ollama-data:
  open-webui-data:

With GPU Support

version: '3.8'

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    runtime: nvidia
    ports:
      - "11434:11434"
    volumes:
      - ollama-data:/root/.ollama
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=compute,utility
    restart: unless-stopped

  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    ports:
      - "3000:8080"
    volumes:
      - open-webui-data:/app/backend/data
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    depends_on:
      - ollama
    restart: unless-stopped

volumes:
  ollama-data:
  open-webui-data:

Start the services:

docker compose up -d

Access at: http://your-server:3000

Initial Setup

First-Time Configuration

  1. Access Web Interface: Navigate to http://your-server:3000
  2. Create Admin Account: First user becomes admin
  3. Pull Models: Download models via Ollama
  4. Configure Settings: Adjust preferences

User Management

Create Users (Admin only):

  1. Settings → Admin Panel → Users
  2. Click "Add User"
  3. Set username, password, role
  4. User receives login credentials

User Roles:

Model Configuration

Add Models:

  1. Settings → Models
  2. Pull models via Ollama first
  3. Models appear automatically in Open WebUI
  4. Set display names and descriptions

Model Settings:

Using Open WebUI

Basic Chat

  1. Select model from dropdown
  2. Type message in input box
  3. Press Enter or click Send
  4. View response with markdown formatting

Document Chat (RAG)

  1. Click document icon
  2. Upload PDF, DOCX, or TXT file
  3. Ask questions about the document
  4. Model cites relevant sections

Supported formats:

Advanced Features

System Prompts:

You are a helpful coding assistant. Always provide code examples and explain your reasoning.

Temperature Control:

Model Comparison:

Configuration Options

Environment Variables

environment:
  # Ollama connection
  - OLLAMA_BASE_URL=http://ollama:11434
  
  # Authentication
  - WEBUI_SECRET_KEY=your-secret-key-here
  
  # Features
  - ENABLE_SIGNUP=false  # Disable public signup
  - DEFAULT_USER_ROLE=user  # Default role for new users
  
  # Limits
  - MAX_UPLOAD_SIZE=100  # MB
  - CHUNK_SIZE=1500  # For document processing
  
  # Database
  - DATABASE_URL=postgresql://user:pass@db:5432/openwebui

Custom Prompts

Create reusable prompts:

  1. Settings → Prompts
  2. Click "Add Prompt"
  3. Name and description
  4. Prompt template with variables

Example:

Explain {{topic}} to a {{level}} audience in {{language}}.

Themes

Built-in themes:

Custom CSS: Admin can add custom styling

Remote Access

  1. Install Tailscale on server and clients
  2. Access via Tailscale IP: http://100.x.x.x:3000
  3. No port forwarding required
  4. Encrypted connection

Via Reverse Proxy

Use NGINX for HTTPS and custom domain:

server {
    listen 443 ssl http2;
    server_name llm.yourdomain.com;
    
    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;
    
    # Increased timeouts for LLM responses
    proxy_read_timeout 600s;
    proxy_connect_timeout 150s;
    
    location / {
        proxy_pass http://localhost:3000;
        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 X-Forwarded-Proto $scheme;
        
        # WebSocket support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        
        # Disable buffering for streaming
        proxy_buffering off;
    }
}

Performance Optimization

Database

For better performance with many users:

services:
  postgres:
    image: postgres:15
    container_name: openwebui-db
    volumes:
      - postgres-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=openwebui
      - POSTGRES_USER=openwebui
      - POSTGRES_PASSWORD=secure_password
    restart: unless-stopped

  open-webui:
    # ... other config ...
    environment:
      - DATABASE_URL=postgresql://openwebui:secure_password@postgres:5432/openwebui
    depends_on:
      - postgres
      - ollama

volumes:
  postgres-data:

Caching

Enable response caching:

environment:
  - ENABLE_RESPONSE_CACHE=true
  - CACHE_TTL=3600  # 1 hour

Resource Limits

services:
  open-webui:
    # ... other config ...
    deploy:
      resources:
        limits:
          memory: 2G
        reservations:
          memory: 1G

Troubleshooting

Can't Connect to Ollama

Check Ollama is running:

curl http://localhost:11434/api/tags

Verify network:

docker exec open-webui curl http://ollama:11434/api/tags

Check environment variable:

docker exec open-webui env | grep OLLAMA

Slow Response Times

Causes:

Solutions:

Document Upload Fails

Check file size limit:

environment:
  - MAX_UPLOAD_SIZE=100  # Increase if needed

Check disk space:

docker exec open-webui df -h

Login Issues

Reset admin password:

docker exec -it open-webui python manage.py changepassword admin

Backup & Restore

Backup Data

# Stop Open WebUI
docker stop open-webui

# Backup data volume
docker run --rm \
  -v open-webui-data:/data \
  -v $(pwd):/backup \
  alpine tar czf /backup/open-webui-backup.tar.gz /data

# Start Open WebUI
docker start open-webui

Restore Data

# Stop Open WebUI
docker stop open-webui

# Restore data volume
docker run --rm \
  -v open-webui-data:/data \
  -v $(pwd):/backup \
  alpine tar xzf /backup/open-webui-backup.tar.gz -C /

# Start Open WebUI
docker start open-webui

Best Practices

Security:

Performance:

Maintenance:

User Experience:

Alternatives

Ollama CLI: Command-line interface, no web UI
LM Studio: Desktop app, good for Windows/Mac
Text Generation WebUI: More features, more complex
LibreChat: Multi-provider support (OpenAI, Ollama, etc.)


Related Topics: