π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
title: Deploy with a VPS description: Expose your self-hosted instance securely on a VPS. navigation: icon: i-lucide-server
Once Alexandrie is configured and running with Docker Compose, deploying it on a VPS mainly consists of making the services accessible from the internet securely.
The reverse proxy is the only component that should be exposed publicly. MySQL and the other internal services should remain inaccessible from the internet.
1. Point your domain to the VPS
First, create DNS records pointing your domain or subdomains to your VPS public IP address.
For example, you can use three subdomains:
| Host | Purpose |
|---|---|
example.com |
The main frontend interface |
api.example.com |
The backend API |
cdn.example.com |
The public file storage endpoint |
Create A records for each hostname:
example.com A <VPS_PUBLIC_IPv4>
api.example.com A <VPS_PUBLIC_IPv4>
cdn.example.com A <VPS_PUBLIC_IPv4>
If you have an IPv6 address, you can also create AAAA records for each hostname.
2. Run the stack
Place your docker-compose.yml and .env in a dedicated directory on the VPS:
mkdir -p ~/alexandrie
cd ~/alexandrie
Start the stack:
docker compose up -d
At this point, the services can be reached from the VPS itself using their configured ports.
3. Configure a reverse proxy
Configure a reverse proxy to expose the frontend and optionally the public file storage endpoint. The backend API should remain inaccessible from the internet.
Option A: Caddy
Caddy is a simple and secure reverse proxy that can automatically manage TLS certificates.
Install Caddy using the instructions for your distribution, then create /etc/caddy/Caddyfile:
example.com {
reverse_proxy localhost:8200
}
api.example.com {
reverse_proxy localhost:8201
}
cdn.example.com {
reverse_proxy localhost:9000
}
Option B: Nginx
Nginx can be used if you prefer to manage the reverse proxy configuration yourself.
For example, create a server block for the frontend:
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:8200;
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;
}
}
The API can use another server block:
server {
listen 80;
server_name api.example.com;
location / {
proxy_pass http://127.0.0.1:8201;
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;
}
}
Finally, the public file storage endpoint can use a third server block.
Once the configuration is working, you can configure HTTPS using your preferred certificate provider, for example Let's Encrypt.
4. Check the deployment
Now that the reverse proxy is configured, you can check that the services are reachable from the internet:
curl -I https://example.com
curl -I https://api.example.com
curl -I https://cdn.example.com
And open the frontend in a browser to check that the instance is working correctly.
If you have trouble or unexpected errors, check the logs of the services and the Q&A page for common issues.