Skip to Content

Open WebUI Setup Guide: Build Your Own Self-Hosted ChatGPT Alternative in 20 Minutes

Deploy a private, fully-featured AI chat interface on your own infrastructure using Docker and Open WebUI.

Open WebUI Setup Guide: Build Your Own Self-Hosted ChatGPT Alternative in 20 Minutes

Tired of subscription fees, data privacy concerns, and rate limits? This Open WebUI setup guide shows you how to deploy a private ChatGPT alternative on your own server—complete with multi-user support, document uploads, and local model execution.

What Is Open WebUI?

Open WebUI is an open-source, self-hosted web interface for AI language models. Think of it as your own private ChatGPT portal—except you control the data, the models, and who gets access.

It connects to:

  • Ollama for running local models (Llama, Mistral, Gemma)
  • OpenAI-compatible APIs (OpenAI, Groq, Together AI, and more)
  • Multiple providers at once—switch between local and cloud models per conversation

Key features that make it production-ready:

  • Multi-user authentication with role-based access
  • Document RAG (upload PDFs, Word docs, code files for context-aware answers)
  • Conversation history and model management
  • WebSocket-based real-time streaming responses
  • Mobile-responsive design
  • Dark mode (obviously)

Prerequisites

Before we start the Open WebUI setup, make sure you have:

Required

  • Docker 20.10+ and Docker Compose v2+ installed
  • A Linux server (Ubuntu 22.04+ recommended) with SSH access
  • At least 4GB RAM (8GB+ recommended for larger models)
  • 20GB free disk space (models are chunky)

Optional but Recommended

  • NVIDIA GPU with CUDA support for faster inference
  • A domain name and SSL certificate for HTTPS
  • Basic familiarity with Docker and command-line tools

Quick Docker Install (if you don't have it)

# Update package index
sudo apt update && sudo apt upgrade -y

# Install Docker
sudo apt install -y docker.io docker-compose-v2

# Add your user to the docker group (log out and back in after)
sudo usermod -aG docker $USER

# Verify installation
docker --version
docker compose version

Step 1: Choose Your Deployment Strategy

Open WebUI gives you three main paths. Pick the one that fits your setup:

Strategy Best For Complexity
Standalone Connecting to existing Ollama or cloud APIs Low
Bundled with Ollama All-in-one local deployment Low
Docker Compose Production with persistent storage and customization Medium

This guide covers the Docker Compose approach—it's the most flexible and production-ready.

Step 2: Create the Docker Compose Configuration

Create a project directory and a docker-compose.yml file:

mkdir ~/openwebui && cd ~/openwebui
nano docker-compose.yml

Paste this configuration:

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    volumes:
      - ollama:/root/.ollama
    restart: unless-stopped
    tty: true
    # Uncomment for NVIDIA GPU support:
    # deploy:
    #   resources:
    #     reservations:
    #       devices:
    #         - driver: nvidia
    #           count: all
    #           capabilities: [gpu]

  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    volumes:
      - open-webui:/app/backend/data
    depends_on:
      - ollama
    ports:
      - "3000:8080"
    environment:
      - 'OLLAMA_BASE_URL=http://ollama:11434'
      - 'WEBUI_SECRET_KEY=your-secret-key-here-change-me'
      - 'ENABLE_SIGNUP=true'
      - 'DEFAULT_MODELS=llama3.2'
    extra_hosts:
      - host.docker.internal:host-gateway
    restart: unless-stopped

volumes:
  ollama:
  open-webui:

Important: Replace your-secret-key-here-change-me with a real secret. Generate one with:

openssl rand -hex 32

Without WEBUI_SECRET_KEY, you'll get logged out every time the container restarts. Don't skip this.

Step 3: Launch the Stack

Start everything with one command:

docker compose up -d

Pulling images takes a few minutes on first run. Check progress with:

docker compose logs -f

Once you see Application startup complete, hit Ctrl+C to exit log view.

Verify both containers are running:

docker ps

# Expected output:
# CONTAINER ID   IMAGE                           STATUS         PORTS
# xxxxxxxx       ghcr.io/open-webui/open-webui   Up 2 minutes   0.0.0.0:3000->8080/tcp
# xxxxxxxx       ollama/ollama                   Up 2 minutes   11434/tcp

Step 4: Download Your First Model

Ollama doesn't ship with models pre-installed. Pull one:

# Llama 3.2 (3B parameters, fast, good for testing)
docker exec -it ollama ollama pull llama3.2

# Or Mistral 7B (better reasoning, larger)
docker exec -it ollama ollama pull mistral

# Or CodeLlama for coding tasks
docker exec -it ollama ollama pull codellama

Model downloads range from 2GB to 8GB+. On a decent connection, Llama 3.2 finishes in under 5 minutes.

Step 5: First Login and Configuration

Open your browser to http://your-server-ip:3000.

On first visit, you'll create an admin account. This first user automatically gets admin privileges.

Essential First Steps

  1. Go to Settings (gear icon) → Admin Settings
  2. Configure default model: Select the model you pulled (e.g., llama3.2:latest)
  3. Set user registration policy: Decide if you want open signups or invite-only
  4. Enable RAG if needed: Settings → Documents → toggle "Enable Retrieval Augmented Generation"

Connecting to Cloud APIs (Optional)

If you want to mix local and cloud models, add API connections:

  1. Admin Panel → Settings → Connections
  2. Add OpenAI API key for GPT-4 access
  3. Add Groq, Together AI, or any OpenAI-compatible endpoint

Users can now switch between local and cloud models per conversation.

Step 6: Secure for Production

Running on port 3000 over HTTP is fine for testing. For production, you need SSL and a reverse proxy.

Nginx Reverse Proxy with SSL

Create /etc/nginx/sites-available/openwebui:

server {
    listen 80;
    server_name chat.yourdomain.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name chat.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        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;
        proxy_read_timeout 86400;
    }
}

Enable the site:

sudo ln -s /etc/nginx/sites-available/openwebui /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Critical: WebSocket support is required. The Upgrade and Connection headers above handle this. Without them, responses won't stream.

Firewall Rules

# Allow HTTPS only
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw deny 3000/tcp
sudo ufw enable

Tips and Troubleshooting

"Cannot connect to Ollama" errors

Check that the Ollama container is healthy:

docker exec ollama ollama list
curl http://localhost:11434/api/tags

If Ollama is on a different host, update OLLAMA_BASE_URL in your compose file.

Models are slow on CPU

Enable GPU support by uncommenting the GPU section in the Ollama service. Verify NVIDIA Docker runtime is installed:

docker run --rm --gpus all nvidia/cuda:12.0-base nvidia-smi

Getting logged out constantly

You didn't set WEBUI_SECRET_KEY. Set it to a persistent value and restart:

docker compose down
# Edit docker-compose.yml, set WEBUI_SECRET_KEY
docker compose up -d

Updating to the latest version

docker compose down
docker compose pull
docker compose up -d

Backup your data

Your data lives in Docker volumes. Back them up:

docker run --rm -v openwebui_open-webui:/data -v $(pwd):/backup alpine tar czf /backup/open-webui-backup.tar.gz -C /data .

Enable single-user mode (no login required)

For personal use on a trusted network, add to environment:

- 'WEBUI_AUTH=False'

Warning: You cannot switch back to multi-user mode later without data loss. Only use this for solo deployments.

What's Next?

You now have a fully functional, self-hosted ChatGPT alternative. Here's where to go from here:

  • Upload documents for RAG—ask questions about your PDFs and codebases
  • Create custom model presets with specific system prompts for different tasks
  • Invite your team and manage access through the admin panel
  • Experiment with different models—mix local privacy with cloud power
  • Set up automated backups and monitoring for production use

Open WebUI is actively maintained with frequent updates. Star the GitHub repo and watch releases to stay current.

Need Help With Production Deployment?

This Open WebUI setup guide gets you running quickly, but production deployments need more: SSO integration, high-availability setup, model fine-tuning, custom RAG pipelines, and security hardening.

If you're deploying AI infrastructure for your team or organization and want it done right the first time, get in touch with our team. We specialize in self-hosted AI platforms that keep your data in your control.

OpenClaw Docker VPS Deploy: Your Own AI Agent Gateway in 30 Minutes
Deploy OpenClaw on any VPS using Docker Compose, secure it with SSL, and start orchestrating AI agents from the cloud.