Self-host Ollama
Server and command-line tool that downloads open language models and runs them locally, exposing them through an HTTP API on port 11434. Run your own Ollama on an always-on EnvHaven workspace by asking its coding agent: one request installs it, puts it on an HTTPS address and locks it down. What the agent takes care of, and the manual route.
Updated November 23, 2026
Running your own Ollama usually means a list of server chores: a machine that stays on, Docker or a runtime, a reverse proxy with certificates, a domain, and the settings that make Ollama behave behind all of it. On an EnvHaven workspace you skip the list. You ask the coding agent, and it does the work while you watch.
Just ask your agent
Open a Pro workspace (Ollama runs in Docker, which Plus and Pro include), tap Launch to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:
Set up Ollama on this workspace and give me the link. Follow https://envhaven.com/self-host/ollama.md
Then open the link it sends and create your Ollama account straight away, before anyone else finds the address. That is the whole request: the address in it is this page’s Markdown copy, and the agent follows the instructions for it further down, with every setting Ollama’s docs require.
Or keep it private with Tailscale
The preview URL puts Ollama on the public internet, which suits something other people need to reach. For an app only you and your household use, your tailnet is the better home: Tailscale gives Ollama an HTTPS address that only your own devices, signed in to your Tailscale account, can open. Save a Tailscale auth key in the workspace’s Vars pane as TS_AUTHKEY, and ask the agent:
Set up Ollama on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/ollama.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
- A Tailscale container runs beside Ollama, so it keeps its private address through workspace restarts and updates, and every app you set up this way gets an address of its own.
- Anything other services have to reach, such as a webhook, still needs a public address. Keep self-hosted apps private with Tailscale covers both, and what Tailscale’s free plan includes.
| At a glance | |
|---|---|
| What it is | AI chat, models and agent tools |
| License | MIT |
| Runs as | Docker (ollama/ollama) |
| Memory | No general minimum is documented. The quickstart model recommends 8 GB of available VRAM or unified memory, and says Ollama can use system RAM with less VRAM, but responses may be slower. (docs) |
| Plan that fits | Pro or larger |
| Web port | 11434 |
| Documentation | docs.ollama.com/linux |
What your agent takes care of
- Installing it. Ollama runs from the official image,
ollama/ollama, with its data in folders under~/apps/ollama. - Putting it on an HTTPS address. The workspace’s preview URL serves it, and your own domain can too.
- Locking it down first. What Ollama’s docs say to set before it faces the internet, below.
- Telling you what to back up: /usr/share/ollama/.ollama/models (Linux with the standard installer; change with OLLAMA_MODELS), Docker volume ollama mounted at /root/.ollama and ~/.ollama/server.json for settings (docs).
The settings it needs behind a proxy
OLLAMA_HOST: Bind address and port; the default is 127.0.0.1:11434, so a proxy or tunnel on the same machine can reach it without changing it. (docs)- Reverse proxy with Nginx: Forward all paths to http://localhost:11434 and set the Host header to localhost:11434. (docs)
- Cloudflare Tunnel: Run cloudflared with --url http://localhost:11434 and --http-host-header=“localhost:11434”. (docs)
OLLAMA_ORIGINS: Extra allowed origins for cross-origin browser requests; by default only 127.0.0.1 and 0.0.0.0 are allowed. (docs)
Before it faces the internet
- The API has no authentication, so a public hostname needs a proxy or tunnel with its own access control; the server binds 127.0.0.1 unless OLLAMA_HOST is changed. (docs)
Things to ask next
Everything after the install is one more sentence to the agent. Some that come up:
- “Connect it to the API keys in my Vars pane, and make Claude the default model.”
- “Add a second user account for my partner, without admin rights.”
- “Move Ollama to app.example.com.” Add the domain on the dashboard’s Domains page with a CNAME to
domains.envhaven.app, and the agent changes Ollama’s address settings to match. - “Update Ollama to the latest release.” It pulls the new image and recreates the container, data kept.
Instructions for the agent
The agent reads these from the page’s Markdown copy. They also work pasted on their own, if you would rather give them in your own words.
Set up Ollama on this workspace and serve it at my preview URL.
- Use Docker Compose with the official image, ollama/ollama. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- Keep the compose file in ~/apps/ollama and all of its data in folders there (bind mounts, not named volumes), with restart: unless-stopped on every service.
- This server has no firewall, so publish no port on its public IP, and drop host networking and privileged mode from the docs' compose file. Docker runs on the host: connect this workspace to the compose network and relay my preview URL's port to Ollama's port 11434.
- The preview URL terminates HTTPS in front of Ollama: serve plain HTTP on its port, and trust the forwarded headers the relay passes on.
- Set what "The settings it needs behind a proxy" lists on https://envhaven.com/self-host/ollama.md for the preview URL, as Ollama's docs describe for running behind a proxy; skip any that apply only when Ollama serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/ollama.md.
- When it answers at the preview URL, send me the link and tell me what to back up.
- If I asked for my tailnet instead of the preview URL, set Ollama up the same way but follow https://envhaven.com/guides/self-host-privately-with-tailscale.md for the network: no preview URL, no relay.
What to know
- In Docker, Ollama’s containers keep running when the workspace restarts or updates. The relay from the preview URL is a process in the workspace, so after a restart or an update, ask the agent to restore it.
- With no GPU, inference runs on the CPU and uses system memory, which limits how many models stay loaded at once; the CPU default is 3 loaded models. (docs)
- Requests that arrive while memory is full are queued, and when the queue is full the server answers 503. (docs)
- The default context length depends on VRAM (4k tokens below 24 GiB); the docs say tasks with large context such as agents and coding tools should be set to at least 64000 tokens, and a larger context length increases the memory a model needs. (docs)
- Ollama’s cloud models and web search can be switched off for a local-only server with OLLAMA_NO_CLOUD=1. (docs)
- A workspace has one preview URL and one custom domain, both serving the same port, so it puts one app on a public address at a time.
Without a workspace
The manual route, on a server you run:
- Rent a Linux VPS, secure SSH, and create a user for the app.
- Install Docker and write a compose file from the official image.
- Put a reverse proxy in front (Caddy, nginx or Traefik), get certificates, and point a domain at the server.
- Set the proxy settings listed above for that domain, and pass WebSocket upgrades through the proxy if the app uses them.
- Keep the firewall closed except for the proxy, and schedule backups and updates.
Ollama’s own documentation covers each step for its install methods.
Sources
Facts about Ollama come from its own documentation, checked on 2026-11-23: