Skip to content

Build your personal knowledge base with Trilium Notes

chore(server): add infrastructure for running Nginx Proxy Manager

Elian Doran5c88b1c6b881
diff --git a/apps/server/docker/nginx-proxy-manager/README.md b/apps/server/docker/nginx-proxy-manager/README.md
new file mode 100644
index 0000000000..0d25882e00
--- /dev/null
+++ b/apps/server/docker/nginx-proxy-manager/README.md
@@ -0,0 +1,51 @@
+# Nginx Proxy Manager (for testing reverse proxy setups)
+
+## Quick start
+
+1. Start Trilium on the host (default port 8080):
+ ```bash
+ pnpm run server:start
+ ```
+
+2. Start Nginx Proxy Manager:
+ ```bash
+ docker compose up -d
+ ```
+
+3. Open the NPM admin panel at **http://localhost:8081** and log in with:
+ - Email: `[email protected]`
+ - Password: `changeme`
+ (You'll be asked to change these on first login.)
+
+4. Add a proxy host:
+ - **Domain Names**: `localhost`
+ - **Scheme**: `http`
+ - **Forward Hostname / IP**: `host.docker.internal`
+ - **Forward Port**: `8080`
+ - Enable **Websockets Support** (required for Trilium sync)
+
+5. Access Trilium through NPM at **http://localhost:8090**.
+
+## With a subpath
+
+To test Trilium behind a subpath (e.g. `/trilium/`), add a **Custom Nginx Configuration** in NPM under the **Advanced** tab of the proxy host:
+
+```nginx
+location /trilium/ {
+ 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_pass http://host.docker.internal:8080/;
+ proxy_cookie_path / /trilium/;
+ proxy_read_timeout 90;
+}
+```
+
+## Cleanup
+
+```bash
+docker compose down -v
+```
diff --git a/apps/server/docker/nginx-proxy-manager/docker-compose.yml b/apps/server/docker/nginx-proxy-manager/docker-compose.yml
new file mode 100644
index 0000000000..f0ed292793
--- /dev/null
+++ b/apps/server/docker/nginx-proxy-manager/docker-compose.yml
@@ -0,0 +1,19 @@
+services:
+ nginx-proxy-manager:
+ image: "jc21/nginx-proxy-manager:latest"
+ restart: unless-stopped
+ ports:
+ # Public HTTP port
+ - "8090:80"
+ # Admin panel
+ - "8081:81"
+ volumes:
+ - npm_data:/data
+ - npm_letsencrypt:/etc/letsencrypt
+ # Use host network mode so NPM can reach Trilium on the host.
+ extra_hosts:
+ - "host.docker.internal:host-gateway"
+
+volumes:
+ npm_data:
+ npm_letsencrypt: