Home AI SkillsOpen WebUI on Linux: Self-Host a Private AI Chat Tool

Open WebUI on Linux: Self-Host a Private AI Chat Tool

by Knowledge Base Linux
Open WebUI on Linux private AI chat interface running on a Linux server with a local model and privacy shield

Cloud AI chat tools are convenient, but every prompt you type leaves your server and lives on someone else’s infrastructure. Open WebUI on Linux gives you the familiar chat interface of a commercial AI assistant, running entirely on your own machine, with your prompts staying local and your choice of model behind the interface.

Open WebUI on Linux Docker container hosting a web chat app connected to a local language model with no cloud connection

This guide shows how to run Open WebUI on Linux with Docker: installing it, connecting it to a local Ollama model, putting it behind HTTPS, creating users, and backing it up. If you already self-host automation, see our self-hosted n8n guide, and for running local models themselves, our local Ollama models guide.

Prerequisites

  • A Linux server or VM with at least 8 GB of RAM, Docker Engine and the Compose plugin installed, and a domain name pointing at the server if you want HTTPS.
  • Ollama installed on the same host or reachable on your network, with at least one model pulled, for example a small chat model for testing.
  • Basic familiarity with Docker Compose and reverse proxies. A GPU helps for larger models but is not required for a small test model.

Open WebUI on Linux: Installation with Docker Compose

Open WebUI ships as a container image and stores its data in a volume. Create a project directory, write a Compose file, and start it. The container listens on port 3000 by default; publish it on localhost only at first, and put a reverse proxy in front of it before exposing it publicly.

mkdir -p ~/open-webui/data
cd ~/open-webui
cat > compose.yaml << 'EOF'
services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    restart: unless-stopped
    ports:
      - "127.0.0.1:3000:8080"
    volumes:
      - ./data:/app/backend/data
    environment:
      - OLLAMA_BASE_URL=http://host.docker.internal:11434
    extra_hosts:
      - "host.docker.internal:host-gateway"
EOF
docker compose up -d
docker compose logs -f open-webui

On Linux, host.docker.internal with the host-gateway mapping lets the container reach Ollama running on the host. If Ollama runs on another machine, replace the URL with that machine’s address and make sure its port is reachable only from your server, not from the internet.

Connecting Open WebUI to Ollama and Your First Chat

Open the interface at http://localhost:3000 through an SSH tunnel or your reverse proxy, create the first admin account, and go to Settings, then Connections, to confirm the Ollama URL. If the model list is empty, check that Ollama is running and that the URL is correct; the most common failure is a container that cannot reach the host’s Ollama port.

ollama list
curl http://localhost:11434/api/tags
docker exec open-webui curl -s http://host.docker.internal:11434/api/tags

The third command tests connectivity from inside the container, which is the test that matters. Once models appear, start a chat, pick a model, and try a few prompts. Open WebUI also supports document uploads for retrieval-augmented chat, web search integration, and image generation through external providers, but start with plain local chat and add features one at a time so you can tell which change broke something.

Securing Open WebUI on Linux

Never expose Open WebUI directly to the internet without authentication and HTTPS. Put it behind Nginx or Caddy with a TLS certificate, enable sign-ups only while you create your accounts and then disable public registration, and use strong passwords plus a separate account per user so activity is attributable. If you use an external identity provider, configure it through Open WebUI’s authentication settings rather than sharing one admin account.

server {
    listen 443 ssl;
    server_name chat.example.com;
    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Replace the example domain with your own, and obtain a certificate with your ACME client before going live. Also restrict Ollama itself: Ollama’s API has no authentication by default, so bind it to localhost or a private network and never publish its port publicly. A public Ollama endpoint is an open compute resource for anyone who finds it.

Backing Up and Updating Open WebUI

All Open WebUI data lives in the volume you mounted, so a backup is a copy of that directory plus your Compose file. Stop the container for a consistent copy, archive the data, and store the archive off the server:

cd ~/open-webui
docker compose down
tar -czf open-webui-backup.tar.gz data compose.yaml
docker compose up -d

Update by pulling the new image and recreating the container, keeping the same volume so chats and settings survive. Read the release notes first: major versions sometimes change the data format, and a backup taken before the update is the only safe rollback. Test the update on a copy of the data if your chats matter.

docker compose pull
docker compose up -d
docker compose logs -f open-webui

Troubleshooting Open WebUI on Linux

No models appear in the model list. Check the Ollama URL in Settings, confirm Ollama is running on the host, and test from inside the container with the curl command above. On Linux, the host-gateway mapping is required; without it, host.docker.internal does not resolve.

Chats are slow or out of memory. Small models run on CPU but slowly; larger models need a GPU or more RAM. Start with a small model, check memory with free -h while generating, and do not run a model larger than your hardware can hold.

Login page loops or shows an error after an update. Check container logs for a migration error, restore the pre-update data backup if needed, and clear browser cache for the site. If the database is corrupt, restoring the backup is faster than debugging the migration.

Registration is open to anyone. Disable public sign-ups in the admin settings immediately, change the admin password, and check for unknown accounts. Open registration on a public URL is how strangers get free access to your models and compute.

Open WebUI on Linux Best Practices

Keep Open WebUI behind HTTPS with authentication, keep Ollama private, back up the data volume regularly, and update deliberately with a backup in hand. Start with one small local model, prove the whole stack works, then add users, documents, and larger models as your hardware allows. Privacy is the point of self-hosting, so protect the interface as carefully as you protect the data it serves.

Open WebUI on Linux turns a capable local model into a usable daily tool, without sending your prompts to a third party. Install it with Docker, connect it to Ollama, secure it behind HTTPS, and back it up like any other service you depend on. For the official reference, see the Open WebUI documentation.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.