Skip to main content
Nginx acts as the front door to your NodeForgeCMS deployment: it terminates TLS, routes public traffic to the Node.js server running on port 3000, serves the built admin panel as static files, and efficiently handles uploaded media. The configuration differs slightly depending on which domain topology you chose, so follow the tab that matches your setup. Before configuring Nginx, make sure:
  • Nginx is installed (nginx -v should return a version)
  • Your Node.js server is running via PM2 on port 3000
  • You’ve built the admin panel for your topology (see build commands below)
  • You’ve replaced /path/to/NodeForgeCMS with the actual absolute path to your project root on disk

Build the Admin Panel

The admin panel is a static Vue application that must be compiled before Nginx can serve it. The build command differs by topology:
Output is written to admin/dist/. Nginx will serve this directory directly from admin.yourdomain.com.

Nginx Configuration

With the separate-domain topology, the public site and the admin panel each get their own server block. The public site proxies all traffic to the Node.js server; the admin panel is served as static files with only the /api/ path proxied back to Node.js.Create or edit /etc/nginx/sites-available/nodeforge with the following content:
Enable the config and reload Nginx:

Enable HTTPS with Let’s Encrypt

Always run HTTPS in production. Certbot can automatically obtain a free TLS certificate from Let’s Encrypt and update your Nginx configuration in one command:
Certbot automatically modifies your Nginx config to listen on port 443 and sets up an HTTP → HTTPS redirect. Certificates renew automatically via a systemd timer or cron job — verify with sudo certbot renew --dry-run.

Starting the Node.js Server with PM2

Nginx proxies to a Node.js process on port 3000. Use PM2 to manage that process:
Useful PM2 commands: