trilium/apps/server/docker/nginx.conf
Elian Doran 04de919876
chore(server): make the subdir Nginx proxy reachable on Docker Desktop
`--network=host` puts the container in the WSL2 VM's network namespace,
which Docker Desktop does not forward to the Windows host: the container
port was never reachable and `127.0.0.1:8082` resolved to the VM's own
loopback rather than the server's. Publish the port instead, and address
the backend through `host.docker.internal` — `--add-host=host-gateway`
keeps that name resolvable on Linux, where it is not defined by default.

Also move the listener off 8090: the dev server derives its Vite HMR port
as `port + 10`, so a server on 8080 already holds it, and the browser
reached the HMR WebSocket (which answers plain HTTP with 426 "Upgrade
Required") instead of the proxy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 18:46:57 +03:00

16 lines
530 B
Nginx Configuration File

server {
listen 8095;
location /trilium/ {
rewrite ^/trilium(/.*)$ $1 break;
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:8082;
proxy_cookie_path / /trilium/;
proxy_read_timeout 90;
}
}