Setting up an Nginx Reverse Proxy for Serving Multiple Node.js Apps from Subfolders

If you’re running multiple Node.js scripts under the same domain on a VPS like DigitalOcean, you’ll need to use a reverse proxy since two Node.js apps can’t listen on the same port. Nginx is a popular choice for setting up a reverse proxy. To begin, you’ll need to edit the Nginx configuration file: sudo nano /etc/nginx/sites-available/default The default configuration file looks like this: server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index....

What is a Reverse Proxy?

In the world of servers, the term “reverse proxy” often comes up. But what exactly is a reverse proxy and what is it useful for? To start, let’s first discuss the concept of a proxy. A proxy is a server that accepts connections from clients who have configured their network settings to use the proxy server. When a client establishes a connection to a server, their requests are routed through the proxy server....