n8n is open-source, which means you can run it on your own server and get unlimited workflow executions for the price of a VPS (often $5–$10/month) instead of per-execution cloud pricing. This guide sets up a production-ready, HTTPS-secured n8n instance using Docker and Nginx. It assumes basic comfort with the command line.
By the FlowsOnDemand editorial team · Last updated May 2026
In your DNS provider, create an A record for n8n.yourdomain.com pointing to your VPS's public IP address. DNS can take a few minutes to propagate — you can continue with setup while it does.
SSH into your server and run: `curl -fsSL https://get.docker.com | sh` to install Docker. Docker Compose v2 ships as a plugin with modern Docker installs — confirm with `docker compose version`.
Run `docker --version` and `docker compose version` to confirm both installed before continuing.
Make a directory (`mkdir ~/n8n && cd ~/n8n`) and create a `docker-compose.yml` defining the n8n service. Set the environment variables N8N_HOST=n8n.yourdomain.com, N8N_PROTOCOL=https, WEBHOOK_URL=https://n8n.yourdomain.com/, and a volume (e.g., `~/n8n/data:/home/node/.n8n`) so your workflows persist across restarts.
Always mount a volume for /home/node/.n8n — without it, every workflow you build is lost when the container restarts.
In the same compose file, set N8N_BASIC_AUTH_ACTIVE=true, N8N_BASIC_AUTH_USER, and N8N_BASIC_AUTH_PASSWORD to lock the editor behind a login. Never expose an n8n instance to the internet without authentication.
Run `docker compose up -d`. n8n starts on port 5678 inside the container. Check it's running with `docker compose logs -f` — you should see "n8n ready on ::, port 5678."
Install Nginx (`apt install nginx`), then create a server block for n8n.yourdomain.com that proxy_passes to http://127.0.0.1:5678. Include the WebSocket upgrade headers (proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";) — n8n's editor relies on WebSockets.
Missing the WebSocket upgrade headers is the #1 cause of a blank or constantly-reloading n8n editor behind Nginx.
Install Certbot (`apt install certbot python3-certbot-nginx`) and run `certbot --nginx -d n8n.yourdomain.com`. Certbot fetches a free Let's Encrypt certificate and rewrites your Nginx config to serve HTTPS with auto-renewal.
Visit https://n8n.yourdomain.com, enter your basic-auth credentials, then create your n8n owner account. You now have a private, unlimited n8n instance. Build your first workflow with the "+" button.
Ready to build it?
n8n is the platform used in this guide.