Running a Node.js app directly on the public internet is rarely the best production approach. Putting Nginx in front gives you easier TLS handling, cleaner logging, better static asset delivery and more control over request behaviour. It also makes the application easier to supervise with systemd and standard Linux tooling.
This beginner’s guide explains the production basics of reverse proxying a Node.js app with Nginx.
Run the app on localhost, not publicly
Have the Node.js service listen on a local port such as 127.0.0.1:3000 rather than binding it directly to the world. Then let Nginx handle public HTTP and HTTPS traffic.
Use systemd to keep the app managed
Systemd gives you controlled startup, restarts and logging. A proper service file is more reliable than a forgotten terminal session or improvised shell script.
Pass the correct proxy headers
Your app may need to know the original host, protocol and client IP. Nginx should pass these intentionally so the application can generate correct URLs and logs.
Handle WebSockets if the app needs them
Real-time apps often need the connection upgrade behaviour configured explicitly. Missing that step can cause confusing intermittent breakage.
Final thoughts
Nginx and Node.js work very well together when the basics are set up properly. Keep the app internal, let Nginx handle the edge and manage the service like production infrastructure rather than a dev experiment.
