Installing the server
Your own domain with HTTPS
In domain mode the installer puts Memex behind nginx or Apache when one of them is present, or lets Memex serve HTTPS itself when nothing else uses ports 80 and 443. In every case the domain must first point to the machine: create the DNS record before you start.
Prerequisites
- A domain or sub-domain you control, for example
brain.example.com. - A server with a public IP address, and ports 80 and 443 reachable from the internet (check the firewall of the machine and of the hosting provider).
- For automatic HTTPS behind nginx or Apache:
certbotwith its plugin (apt install certbot python3-certbot-nginx, orpython3-certbot-apache). Without certbot the site is written for HTTP and the installer prints how to add HTTPS later.
Step 1: create the DNS record
At your domain’s DNS provider, create a record that leads the name to the server:
| Name | Type | Value |
|---|---|---|
brain.example.com | A | the public IPv4 address of the server |
brain.example.com | AAAA (optional) | its public IPv6 address, if it has one |
A new record can take a few minutes to be visible. Check it from any machine before going further:
dig +short brain.example.comThe installer runs the same check before requesting a certificate. If the name has no record yet, or leads elsewhere, it says so and offers three choices: Check again, Continue anyway and request the certificate, or Continue without HTTPS for now.
Step 2: run the installer in domain mode
- Start the installerRun
curl -fsSL https://raw.githubusercontent.com/mlafraise/memex/main/install.sh | sh, orsudo memex installif the program is already there. - Choose "With a domain name (HTTPS)"Then type the domain name.
- Read what was detectedThe assistant reports one of: "nginx was found: Memex will be placed behind it", the same for Apache, "No web server was found on ports 80/443: Memex will serve the domain itself", or that another program uses the ports.
- Accept automatic HTTPSAnswer yes to "Set up HTTPS automatically with a free Let’s Encrypt certificate?" and optionally give an e-mail address for certificate expiry notices.
- Confirm the planThe assistant lists what it will do and asks "Proceed?".
The same without questions:
sudo memex install --mode domain --domain brain.example.com --yes--proxy nginx|apache|none forces the choice of reverse proxy, and --https off skips HTTPS.
What the installer does in each case
nginx is present
A site file is written (/etc/nginx/sites-available/memex.conf with its link in sites-enabled on Debian and Ubuntu, /etc/nginx/conf.d/memex.conf elsewhere), checked with nginx -t, and nginx is reloaded. The site proxies to 127.0.0.1:<port> with WebSocket support, a 64 MB upload limit, forwarded headers, and buffering turned off for /mcp and /api/v1/events. With certbot installed, the installer runs certbot --nginx -d <domain> to obtain the certificate and switch the site to HTTPS.
Apache is present
The same with a virtual host (/etc/apache2/sites-available/memex.conf, enabled with a2ensite, after a2enmod proxy proxy_http proxy_wstunnel headers rewrite; /etc/httpd/conf.d/memex.conf on Fedora and RHEL), apache2ctl configtest, a reload, and certbot --apache. If SELinux is enforcing, allow Apache to reach Memex with setsebool -P httpd_can_network_connect 1.
Nothing listens on ports 80 and 443
Memex serves the domain itself and obtains and renews its certificates from Let’s Encrypt (built-in ACME) when it starts. If you decline HTTPS, it serves plain HTTP on port 80.
Safeguards
- Memex never installs, removes or reconfigures nginx, Apache or certbot themselves; it only adds its own site.
- The web server’s configuration is checked before anything is written. If it is already invalid, the installation stops and changes nothing.
- It is checked again with the Memex site in place. If the web server rejects it, the site is removed and the file it replaced, if any, is put back.
- An existing
memex.confthat differs is not overwritten without asking; the previous file is kept asmemex.conf.memex.bak.
Check that it worked
sudo memex status
curl -I https://brain.example.com/memex statusshows the addresshttps://brain.example.com.- The browser opens the instance over HTTPS without a certificate warning.
sudo memex config get public_urlanswers with thehttps://address. AI assistants are given this address, so it must be the one people really use.
Finishing HTTPS afterwards
If certbot failed (most often because the DNS record was not in place yet), or you chose to continue without HTTPS, the installation completed over HTTP and said so. Once the record is visible, finish in three commands:
sudo certbot --nginx -d brain.example.com
sudo memex config set public_url https://brain.example.com --restart
sudo memex statusUse certbot --apache behind Apache. Setting public_url matters as much as the certificate: while it still says http://, authorising an AI assistant fails. Both problems are described in Troubleshooting.