Installing the server
Behind an existing reverse proxy
When a program other than nginx or Apache already holds ports 80 and 443, for example Caddy, HAProxy or Traefik, the installer does not touch it. Memex listens on 127.0.0.1:<port> and the installer tells you what to forward to it. You then add the route in your proxy yourself.
Install in domain mode
Choose "With a domain name (HTTPS)" and give the domain. The assistant reports that ports 80/443 are used by the program it found, that Memex will listen locally, and that you will point that program at it. Without questions:
sudo memex install --mode domain --domain brain.example.com --proxy none --yesnginx and Apache are different: the installer configures them for you, as described in Your own domain with HTTPS.
What the proxy must do
- Forward the domain to
http://127.0.0.1:8787(or the port you chose). - Support WebSocket upgrades: the app receives real-time events over a WebSocket.
- Not buffer responses on
/mcpand/api/v1/events. - Pass the
X-Forwarded-*headers, so that Memex sees the real address of each visitor. - Allow uploads as large as the files you store. Memex accepts files up to 50 MB; the site it writes for nginx sets a 64 MB limit.
- Terminate HTTPS and renew its certificate, as your proxy already does for other sites.
Two settings to verify
sudo memex config get public_url
sudo memex config get trusted_proxypublic_urlmust be the address people really use, withhttps://. It is used in the links Memex sends and given to AI clients; a wrong scheme makes the authorisation of an AI fail.trusted_proxymust betruewhen a reverse proxy sits in front of Memex, so that itsX-Forwarded-*headers are believed. Otherwise every visitor shares the proxy’s address and its rate limits.
sudo memex config set public_url https://brain.example.com
sudo memex config set trusted_proxy true --restartCheck that it worked
curl -I http://127.0.0.1:8787/
curl -I https://brain.example.com/The first command checks Memex itself, the second the route through your proxy. In the app, a note edited in one browser window should update in another without a refresh: that confirms the real-time connection passes through the proxy.