Self-host 15/16: Ollama + Open WebUI
In this series, you will learn how to self-host 16 services on your server. To self-host a service, you can either use a server at home or a server in the cloud.
Nginx Proxy Manager
The first thing you need to set up is a reverse proxy, so you can go to a domain or subdomain to access the service.
Install docker-compose
Update your package list
sudo apt-get update
Install dependencies
sudo apt-get install ca-certificates curl gnupg lsb-release
Add Docker’s official GPG key
sudo apt-get install ca-certificates curl gnupg lsb-release
Set up the stable repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update your package list
sudo apt-get update
Install Docker Engine
sudo apt-get install docker-ce docker-ce-cli containerd.io
Verify that Docker Engine is installed correctly
sudo docker run hello-world
Download the current stable release of Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Apply executable permissions to the binary
sudo chmod +x /usr/local/bin/docker-compose
Verify the installation
docker-compose --version
Create directory
Create a directory
Change “name-of-the-service” with the actual name of the container
mkdir -p ~/docker-compose/name-of-the-service
Move into the directory
Change “name-of-the-service” with the name you choose above
cd ~/docker-compose/name-of-the-service
Create a docker-compose.yml file
Create a docker-compose.yml file
nano docker-compose.yml
Past this content into the file
version: '3.8'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
Press “ctrl + o” to save the file
Press “ctrl + x” to exit the file
Start the docker-compose container
Start the docker-compose container
sudo docker-compose up -d
Access the service
To access the service, open a browser and type in the following content
http://<your-server-ip>:81
Afterwards, you will be presented by a Nginx Proxy Manager website. Login with this credentials
Email: [email protected]
Password: changeme
Ollama + Open WebUI
Create directory
Create a directory
Change “name-of-the-service” with the actual name of the container
mkdir -p ~/docker-compose/name-of-the-service
Move into the directory
Change “name-of-the-service” with the name you choose above
cd ~/docker-compose/name-of-the-service
Create a docker-compose.yml file
Create a docker-compose.yml file
nano docker-compose.yml
Past this content into the file
services:
ollama:
volumes:
- ollama:/root/.ollama
container_name: ollama
pull_policy: always
tty: true
restart: unless-stopped
image: ollama/ollama:${OLLAMA_DOCKER_TAG-latest}
open-webui:
image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main}
container_name: open-webui
volumes:
- open-webui:/app/backend/data
depends_on:
- ollama
ports:
- ${OPEN_WEBUI_PORT-3000}:8080
environment:
- 'OLLAMA_BASE_URL=http://ollama:11434'
- 'WEBUI_SECRET_KEY='
extra_hosts:
- host.docker.internal:host-gateway
restart: unless-stopped
volumes:
ollama: {}
open-webui: {}
Press “ctrl + o” to save the file
Press “ctrl + x” to exit the file
Start the docker-compose container
Start the docker-compose container
sudo docker-compose up -d
Access the service
To access the service, open a browser and type in the following content
http://<your-server-ip>:11434
Afterwards, you will be presented by the website. Now you can create an account and start using it.
Make the service available via a domain
Login into your Nginx Proxy Manager
Add a host
Click on “Proxy Hosts”
Click on “Add Proxy Host”
Fill in the details
Details
Domain Names: Enter your domain name (e.g. servicename.yourdomain.com
)
Scheme: select “http”
Forward Host / IP: Enter the IP address of your server (enter “localhost” or “127.0.0.1” if its on the same machine)
Forward Port: Enter used port in the config
Cache Assets: Optional, check if needed
Block Common Exploits: Optional, check if needed (recommended)
Websockets Support: Check if your service needs Websocket support
Custom locations
Add location: Optional, check if needed
SSL
SSL Certificate: Select “Request a new SSL Certificate”
Force SSL: Optional, highly recommended automatic redirecting to HTTPS
HSTS Enabled: Optional, check if needed
Use a DNS Challenge: Optional, check if needed
HTTP/2 Support: Optional, check if needed
HSTS Subdomains: Optional, check if needed
Email Address for Let’s Encrypt: Enter your Email address
Agree to the Terms of Services
Advanced
Custom Nginx Configuration: Optional, check if needed
Click “Save”
Enjoy!
I would like to thank you for the efforts you have put in penning this
site. I really hope to check out the same high-grade content from you later on as well.
In truth, your creative writing abilities has inspired me to get my own, personal site now 😉