Setting up SSL certificates for self-hosted n8n installation

I’m trying to configure my local n8n instance to use SSL encryption but can’t get it working properly. I’ve been testing n8n on my own server and want to switch from the default http setup to https for security reasons.

I tried setting these environment variables in my shell configuration:

export N8N_PROTOCOL="https"
export N8N_SSL_KEY=/my/private/key.pem
export N8N_SSL_CERT=/my/certificate/cert.pem

However, when I launch the application, it still shows:

Workflow editor available at:
http://localhost:5678/

The SSL configuration doesn’t seem to take effect and I’m still getting the insecure http connection. Has anyone successfully configured HTTPS for a local n8n deployment? What am I missing in my setup?

Don’t trust that console output! Even with SSL configured properly, n8n still shows the HTTP localhost message. Had this exact headache a few weeks back. Test https://localhost:5678 in your browser, not just HTTP. Also check your PEM files aren’t corrupted - openssl verify saved me when I had a cert that looked fine but was actually broken.

The localhost URL in the console is misleading - n8n always shows that even with SSL working. Your config looks right, but you need to restart the entire n8n service after setting those variables. Just refreshing won’t cut it. I hit this same issue when moving to production. If you’re using Docker or PM2, double-check the environment variables are actually reaching the n8n process. Also make sure your cert chain is complete - self-signed certs need the full chain in the cert file. Try hitting https://localhost:5678 directly in your browser instead of trusting what the console says.

Had the same frustrating issue when I moved my n8n setup to HTTPS last month. Environment variables won’t work if your certificate files have permission problems or wrong paths. Check that the user running n8n can actually read those cert files - I wasted hours before realizing my certs were owned by root with 600 permissions. Use absolute paths for both key and certificate files. n8n might be caching old config too, so stop the process completely and clear temp files before restarting. If you’re still seeing that http localhost message, check your browser connection - sometimes console output doesn’t update but SSL is actually working on the right port.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.