Install Open WebUI on a VPS (Docker + HTTPS)
Open WebUI gives Ollama a ChatGPT-style chat interface — model picker, conversation history, multi-user accounts, document upload for RAG, and OpenAI-API compatibility. Here's the production deploy with Docker, Nginx, and a real certificate.
What Open WebUI gives you
- A clean web UI for chatting with any model Ollama has pulled.
- Multiple user accounts with role-based access.
- Per-conversation model selection.
- Document upload + retrieval-augmented generation (RAG) using local embeddings.
- Persistent conversation history.
- OpenAI-compatible API on top, so other tools can use your local stack.
Prerequisites
- Ollama already running — see Install Ollama on a VPS. At least one model pulled.
- Docker installed — see Docker install.
- A domain (we'll use
chat.example.com). - Same VPS recommended for low Ollama-WebUI latency.
Tested on Ubuntu 22.04, Docker CE 27.3, Open WebUI 0.4.x, Ollama 0.4.6, on a 16 GB Inferno VPS.
Step 1 — The Compose file
mkdir -p ~/open-webui && cd ~/open-webui
nano docker-compose.yml
name: open-webui
services:
open-webui:
image: ghcr.io/open-webui/open-webui:v0.4.7
restart: unless-stopped
ports:
- "127.0.0.1:8080:8080"
volumes:
- open_webui_data:/app/backend/data
environment:
OLLAMA_BASE_URL: "http://host.docker.internal:11434"
WEBUI_SECRET_KEY: "${WEBUI_SECRET_KEY}"
ENABLE_SIGNUP: "false"
DEFAULT_USER_ROLE: "pending"
ENABLE_LOGIN_FORM: "true"
WEBUI_AUTH: "true"
DATA_DIR: "/app/backend/data"
extra_hosts:
- "host.docker.internal:host-gateway"
deploy:
resources:
limits:
memory: 2G
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
open_webui_data:
Important details:
OLLAMA_BASE_URL=http://host.docker.internal:11434+extra_hosts— lets the container reach the host's Ollama daemon on port 11434. This is the cleanest pattern when Ollama is installed natively (not in Docker).ENABLE_SIGNUP=falseandDEFAULT_USER_ROLE=pending— close the open-registration door. The first user you create is the admin; subsequent users land in "pending" status until an admin promotes them.ports: 127.0.0.1:8080— Nginx in front; never expose Open WebUI directly.
Step 2 — Generate the secret key
cat > .env <<EOF
WEBUI_SECRET_KEY=$(openssl rand -base64 32)
EOF
chmod 600 .env
The secret key signs session JWTs. Losing it logs everyone out (annoying); leaking it lets an attacker forge sessions (bad).
Step 3 — Bring it up
docker compose up -d
docker compose logs -f open-webui
Wait for "Application startup complete." The first start downloads embedding models for RAG and takes 1-2 minutes.
Step 4 — Nginx + HTTPS
sudo nano /etc/nginx/sites-available/chat
server {
listen 80;
server_name chat.example.com;
location /.well-known/acme-challenge/ { root /var/www/html; }
client_max_body_size 100M; # for RAG document uploads
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
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_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_read_timeout 600s;
}
}
sudo ln -s /etc/nginx/sites-available/chat /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d chat.example.com --redirect
Step 5 — Create the admin account
Visit https://chat.example.com/. Because we disabled signup but allow the first-account creation, the very first registration becomes admin. Pick a strong password.
After creating the admin, immediately go to Admin Panel → Settings → confirm:
- Default User Role: Pending (so new users can't auto-activate).
- Enable Signup: off (or controlled via admin invites).
Step 6 — Connect to Ollama and pick a default model
Admin Panel → Connections → Ollama. The endpoint should already be set to http://host.docker.internal:11434. Click "Test" — should return green.
In Settings → Models, you'll see whatever Ollama has pulled. Pin a default model for new conversations.
Step 7 — RAG (optional)
Open WebUI ships with built-in embeddings and a vector store. To use it:
- In a chat, click the "+" → "Upload Document." PDF, DOCX, TXT, MD, HTML.
- The document is chunked, embedded, and stored in the local vector DB.
- Subsequent questions in that conversation retrieve relevant chunks and inject them into the prompt.
For better-than-default embeddings, pull nomic-embed-text in Ollama and set it as the embedding model in Admin → Settings → Documents.
Performance and resource use
Open WebUI itself is light — ~300-400 MB RAM. The heavy work is Ollama. On the 16 GB Inferno test box running Ollama + Open WebUI + Nginx, idle memory use stays under 6 GB; loaded with a 14B model the total hits ~12 GB. Plenty of headroom for the typical small-team use case.
Updating
cd ~/open-webui
# Edit docker-compose.yml — bump the tag
docker compose pull
docker compose up -d
docker compose logs -f open-webui
The open_webui_data volume holds users, conversations, and the vector DB — preserved across image updates within the same major version. Back it up the same way as our n8n backup pattern.
Common Open WebUI mistakes
"Connection to Ollama failed"
The host.docker.internal trick depends on Docker 20.10+ and the extra_hosts: host-gateway line. Confirm with docker compose exec open-webui ping host.docker.internal. If Ollama is in its own container, use that container's network alias instead.
"Streaming responses arrive in big chunks"
Nginx is buffering. The proxy_buffering off line in the config example fixes it.
"Document upload returns 413"
Default client_max_body_size is 1 MB. Set to 100M (as in the example) and reload Nginx.
"Anyone can register a new account"
You didn't restart after setting ENABLE_SIGNUP=false, or the variable is set inside Open WebUI's admin settings instead of the env. Set in both places to be safe.
"RAG retrieval returns irrelevant chunks"
The default embedding model is generic. Pull nomic-embed-text via Ollama and set it as the embedding model — meaningfully better retrieval for English text.
VPS for an Ollama + Open WebUI stack?
A 16 GB Inferno plan runs an 8-14B model + Open WebUI + Nginx with room to spare. With local AI inference, all your conversations stay on your hardware.
What to do next
- Ollama install if you skipped ahead.
- Wire Ollama into n8n for AI-driven automations.
- LocalAI alternative with broader model support.
- Best VPS for Ollama sizing guide.
Author: Hanna Wagner — Frankfurt. Last tested: 2026-05-22 on Open WebUI v0.4.7, Ollama 0.4.6, Docker CE 27.3.