Skip to content

Deploy Node Server on Apache

This template shows Apache as a reverse proxy for a Node.js application.

What It Needs

  • Apache with mod_proxy and mod_proxy_http.
  • A Node.js app listening on an internal port such as 3000.
  • A reverse proxy virtual host for the public domain.

Typical Virtual Host

<VirtualHost *:80>
    ServerName node.example.com
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

App Side

  • Keep the Node.js process managed by systemd, PM2, or another supervisor.
  • Bind to a private interface or localhost only.
  • Expose a /healthz endpoint for health checks if possible.

Practical Notes

  • Let Apache handle TLS and public routing.
  • Keep the Node process simple and stateless.
  • Watch both Apache proxy logs and Node logs when debugging.