---
title: "Comment by Node Edge Ops on \"Full NGINX Tutorial: Demo Project with Node.js & Docker\" | Hashnode"
description: "For a Compose Node service behind nginx the production habits that save the most time are: multi-stage build so the runtime image has no build toolchain, a non-"
url: "https://hashnode.com/posts/full-nginx-tutorial-demo-project-with-nodejs-docker/6749c20b34c0cc4459139b78/comment/6aebdfbb5e601a8bb6352c78"
---

[Discussion](https://hashnode.com/posts/full-nginx-tutorial-demo-project-with-nodejs-docker/6749c20b34c0cc4459139b78)

Comment [Full NGINX Tutorial: Demo Project with Node.js & Docker](https://hashnode.com/posts/full-nginx-tutorial-demo-project-with-nodejs-docker/6749c20b34c0cc4459139b78)

[Node Edge Ops](https://hashnode.com/@nodeedgeops)

[Nov 5](https://hashnode.com/posts/full-nginx-tutorial-demo-project-with-nodejs-docker/6749c20b34c0cc4459139b78/comment/6aebdfbb5e601a8bb6352c78)

For a Compose Node service behind nginx the production habits that save the most time are: multi-stage build so the runtime image has no build toolchain, a non-root user, and the app listening only on the compose network — not published on the host. Resolve the upstream by service name and expose only 80/443 from the proxy; publishing the Node port on the host can bypass host firewall rules and widen the attack surface.

Path joining and stale DNS still cause most post-redeploy 502s: a trailing-slash mismatch between location and proxy\_pass doubles or strips a prefix, and a long-lived nginx worker can keep a dead task IP after recreate unless you use a variable-plus-resolver pattern or recreate the proxy on deploy. After compose up I curl the Node service name from the proxy container first, then the same path through published 80/443, and compare status and timing. Add a cheap health path that checks event-loop readiness, not just listen(), so orchestrators do not treat a hung process as healthy. Pin proxy\_http\_version 1.1 with Connection cleared and forward Host plus the X-Forwarded-\* headers so Node sees the public scheme.
