Before you start
- The domain’s A record points at the server:
dig +short postqueen.example.comprints its IP. - Ports 80 and 443 are open. Certbot proves control of the domain over port 80.
- PostQueen answers on the server:
curl -I http://localhost:4007returns200. If you run the image on its own with-p 127.0.0.1:5000:5000, use port 5000 wherever this page says 4007.
Set it up
The commands are for Ubuntu and Debian.1
Install Nginx and Certbot
2
Write the site
Create Then enable it and check the syntax:
/etc/nginx/sites-available/postqueen with your own domain:/etc/nginx/sites-available/postqueen
3
Get the certificate
sudo certbot renew --dry-run tests it.4
Tell PostQueen its address
Put the public address in the Keep The database, Redis and Temporal keep running. Avoid
.env file next to docker-compose.yaml. The shipped Compose file
reads that file and fills these three values into the postqueen service, so there is no YAML to
edit:/api on the last one, and leave off trailing slashes. Leave BACKEND_INTERNAL_URL as it
ships, http://localhost:3000: it is the path from the web app to the API inside the container,
not a public address.Recreate the app container so it reads the new values. A plain docker restart or
docker compose restart keeps the old container and its old environment.In the folder that holds docker-compose.yaml, recreate only the postqueen service:docker compose down for a settings change: on
a host that runs other Compose services in the same project, it stops them too. On Kubernetes, see
Kubernetes with Helm.5
Check it
From your own computer:
HTTP/2 200 or HTTP/1.1 200, then a sign-in in the browser that holds.X-Accel-Buffering: no, which Nginx honors, so no buffering setting is needed. PostQueen uses no WebSockets in production, so no Upgrade headers are needed either.
If it does not work
502 Bad Gateway
502 Bad Gateway
Nginx runs and nothing answers on the port in
proxy_pass. curl -I http://localhost:4007 on the server tells you whether PostQueen is up; if it is, the port in proxy_pass is wrong.413 Request Entity Too Large
413 Request Entity Too Large
client_max_body_size is missing or too small in the server block that serves HTTPS. Certbot adds HTTPS to the block you wrote, so the value above carries over. If you wrote your own listen 443 block, add the line there, then reload.Certbot cannot validate the domain
Certbot cannot validate the domain
The name does not resolve to this server yet, or port 80 is closed. Both have to be true while Certbot runs.
The page loads, sign-in does not stick
The page loads, sign-in does not stick
FRONTEND_URL does not match the address in the browser. See Tell PostQueen its address above.Related
- Domain and HTTPS
- Split deployments: routing when the frontend and backend run apart
- MCP on your server
- Self-hosting troubleshooting