Intermediate10 min read
Deploy a Node.js application with Docker and a reverse proxy
Containerise an application, run it as a service, and put NGINX in front of it.
Last updated 1 August 2026
Install Docker
bash
curl -fsSL https://get.docker.com | sh
systemctl enable --now dockerA minimal compose file
yaml
services:
app:
build: .
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000"
environment:
NODE_ENV: productionBind to localhost
Publishing to 127.0.0.1 keeps the application off the public interface. NGINX is then the only thing listening publicly.Reverse proxy
nginx
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}Was this page useful?
Feedback about article docker-node-app