Secure your environment with HTTPS using self-signed certificates for local development or Let’s Encrypt for production.
1. Enable HTTPS in environment:
Set the protocol in your production or staging environment file:
APP_PROTOCOL=https2. Issue TLS Certificates via Let’s Encrypt:
Run the built-in Certbot script:
make sslThis will:
-
Read
APP_DOMAINfrom.env -
Temporarily stop NGINX
-
Run 🔐 Certbot in standalone mode (
port 80must be open publicly) -
Save certificate files to:
config/ssl/live/<your-domain>/fullchain.pem config/ssl/live/<your-domain>/privkey.pem -
Restart NGINX with HTTPS enabled
ℹ️ If the certificate already exists, the script skips renewal.
⚠️ Ensureport 80is open and not blocked by a firewall or ISP.
3. Manual Certificates (optional):
You may manually place your certificates at:
config/ssl/live/<your-domain>/fullchain.pem
config/ssl/live/<your-domain>/privkey.pem
Let’s Encrypt does not issue certificates for local domains like .localhost. Use self-signed certificates instead.
Install mkcert and run:
mkcert -install
mkcert myproject.localhostThis creates two files, e.g.:
myproject.localhost.pem
myproject.localhost-key.pem
Rename and copy them to:
config/ssl/live/myproject.localhost/fullchain.pem
config/ssl/live/myproject.localhost/privkey.pem
Then update your local environment type file at config/environment/.env.type.local, or create an override file at
config/environment/.env.type.local.override.
➡️ See Environment Configuration and Secret Management for details.
APP_PROTOCOL=httpsStart your environment:
make up📌 Local HTTPS support assumes your domain matches the certificate. Adjust your
/etc/hostsaccordingly.
Generate self-signed certificates using OpenSSL:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout config/ssl/live/myproject.localhost/privkey.pem \
-out config/ssl/live/myproject.localhost/fullchain.pem \
-subj "/CN=myproject.localhost"This creates a self-signed certificate valid for 365 days.
⚠️ Self-signed certificates will trigger browser warnings. You can bypass them for local development. To avoid warnings, you can add the self-signed certificate to your system's trusted certificates store.See Letsencrypt Documentation for more details on using self-signed certificates locally.
The NGINX setup supports both HTTP and HTTPS, with automatic redirection configured via:
config/nginx/config/http.conf.template— used whenAPP_PROTOCOL=httpconfig/nginx/config/https.conf.template— used whenAPP_PROTOCOL=https
Redirection behavior:
- HTTP → HTTPS
www.domain→domain
Configuration is automatically templated and mounted at container start. No manual edits are required in
*.conffiles.