Self-host Trilium Notes
A single-user hierarchical note-taking application for building large personal knowledge bases, available as a desktop app and as a server with a web UI. Run your own Trilium Notes 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 Trilium Notes 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 Trilium Notes 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 Hobby workspace, tap Launch to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:
Set up Trilium Notes on this workspace and give me the link. Follow https://envhaven.com/self-host/trilium.md
Then open the link it sends and create your Trilium Notes 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 Trilium Notes’s docs require.
Or keep it private with Tailscale
The preview URL puts Trilium Notes 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 Trilium Notes 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 Trilium Notes on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/trilium.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
- On Plus and Pro, a Tailscale container runs beside Trilium Notes, 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.
- On Hobby, Tailscale runs in the workspace beside Trilium Notes; after a restart or an update, ask the agent to start both again.
- 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 | Notes, wikis and knowledge bases |
| License | AGPL-3.0-or-later |
| Runs as | Docker (triliumnext/trilium) or a native install |
| Memory | Not documented |
| Plan that fits | Hobby or larger |
| Web port | 8080 |
| Documentation | docs.triliumnotes.org/user-guide/setup/server |
What your agent takes care of
- Installing it. Trilium Notes runs from the official image,
triliumnext/trilium, with its data in folders under~/apps/trilium, or without Docker on Hobby. - Putting it on an HTTPS address. The workspace’s preview URL serves it, and your own domain can too.
- Locking it down first. What Trilium Notes’s docs say to set before it faces the internet, below.
- Telling you what to back up: the data directory (trilium-data; /home/node/trilium-data in the container): document.db (database), config.ini, backup/ (automatic backups), log/ (docs).
The settings it needs behind a proxy
- [Network] trustedReverseProxy in config.ini (env
TRILIUM_NETWORK_TRUSTEDREVERSEPROXY): Comma-separated proxy addresses, CIDR subnets or loopback/linklocal/uniquelocal so Trilium reads the real client IP from X-Forwarded-For and detects HTTPS. (docs) - trustedReverseProxy must not be true: true makes Trilium trust the client-supplied left-most X-Forwarded-For entry, which defeats the brute-force limit. (docs)
- WebSocket upgrade (Upgrade and Connection headers): Sync and live UI updates use a WebSocket; without the upgrade the page loads but never updates. (docs)
- TLS terminated at the proxy; Trilium itself stays on plain HTTP: No public base-URL setting exists in the documented configuration; the proxy supplies TLS. (docs)
TRILIUM_NETWORK_HTTPS,TRILIUM_NETWORK_CERTPATH,TRILIUM_NETWORK_KEYPATH(only if Trilium terminates TLS itself): Built-in HTTPS; the docs prefer a reverse proxy. (docs)
Before it faces the internet
- TLS is treated as mandatory for server installs; terminate it at the proxy or tunnel. (docs)
- Built-in brute-force limit per IP address, which only works per client once the proxy is trusted. (docs)
- A fresh server shows an initialization page; complete it yourself before exposing the port. (docs)
- Do not set trustedReverseProxy=true; list the proxy’s exact address. (docs)
Things to ask next
Everything after the install is one more sentence to the agent. Some that come up:
- “Import this folder of Markdown notes, keeping the folder structure.”
- “Turn off public sign-ups now that my account exists.”
- “Move Trilium Notes to app.example.com.” Add the domain on the dashboard’s Domains page with a CNAME to
domains.envhaven.app, and the agent changes Trilium Notes’s address settings to match. - “Update Trilium Notes 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 Trilium Notes on this workspace and serve it at my preview URL.
- Where Docker has a daemon (Plus and Pro), use Docker Compose with the official image, triliumnext/trilium, starting from the docs' compose file: https://github.com/TriliumNext/Trilium/blob/v0.107.0/docker-compose.yml. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- Keep the compose file in ~/apps/trilium 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 Trilium Notes's port 8080.
- Without Docker (on Hobby, where Docker has no daemon), install it as its docs describe, with the server tarball from its releases, run with `./trilium.sh` (Node.js is bundled in the packaged server; the manual install page lists Node.js 14.x and 16.x as tested and says its information is out of date), into ~/apps/trilium with its data, so it survives workspace updates; global installs and system paths do not. Run it in a tmux window named trilium, listening on 0.0.0.0:8080, and point my preview URL at port 8080.
- The preview URL terminates HTTPS in front of Trilium Notes: 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/trilium.md for the preview URL, as Trilium Notes's docs describe for running behind a proxy; skip any that apply only when Trilium Notes serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/trilium.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 Trilium Notes 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, Trilium Notes’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.
- Without Docker, Trilium Notes runs as a process in the workspace, so after a restart or an update, ask the agent to start it again.
- Single-user only; several people need several instances. (docs)
- Putting Cloudflare Access or another login layer in front of the whole site breaks sync and first-time setup; exempt the sync paths or use Trilium’s own sign-in. (docs)
- Behind a tunnel without trustedReverseProxy, every visitor shares one failed-login limit, so a few wrong attempts from anyone lock everyone out. (docs)
- AI features are off by default and need a cloud API key (or a self-hosted endpoint); Trilium ships no model. (docs)
- Cloud AI providers each need their own paid API key. (docs)
- The shipped compose file pins nothing (latest), which the docs warn can upgrade the instance unexpectedly. (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.
Trilium Notes’s own documentation covers each step for its install methods.
Sources
Facts about Trilium Notes come from its own documentation, checked on 2026-11-23:
- docs.triliumnotes.org/user-guide/setup/server
- docs.triliumnotes.org/user-guide/setup/server/installation/docker
- docs.triliumnotes.org/user-guide/setup/server/installation/packaged-server
- docs.triliumnotes.org/user-guide/setup/server/reverse-proxy/trusted-proxy
- docs.triliumnotes.org/user-guide/setup/server/reverse-proxy
- docs.triliumnotes.org/user-guide/setup/server/https
- docs.triliumnotes.org/user-guide/setup/server/reverse-proxy/nginx
- github.com/TriliumNext/Trilium/blob/v0.107.0/docs/User%20Guide/User%20Guide/Installation%20%26%20Setup/Server%20Installation/1.%20Installing%20the%20server/Multiple%20server%20instances.md
- github.com/TriliumNext/Trilium/blob/v0.107.0/docs/User%20Guide/User%20Guide/Installation%20%26%20Setup/Server%20Installation/Authentication.md
- github.com/TriliumNext/Trilium/blob/v0.107.0/docs/User%20Guide/User%20Guide/AI.md
- github.com/TriliumNext/Trilium/blob/v0.107.0/docs/User%20Guide/User%20Guide/AI/Providers.md
- github.com/TriliumNext/Trilium/blob/v0.107.0/docker-compose.yml
- docs.triliumnotes.org/user-guide/setup/data-directory