Hosting Multiple Domains on a VPS for NodeJS
In order to host several websites
with their own domains on one
VPS server, we need a
reverse proxy server.
This is a program that
will listen on port 80
and route the requests.
We will use the Nginx server
as such a program.
How it will work. Let's say
we have two domains. Let's assume that on our VPS,
the script for the first domain is running
on port 3001, and the script
for the second domain - on port 3002.
The Nginx reverse proxy server will
listen on port 80, check which
domain was requested, and will redirect
the request to the corresponding port.
In the following tutorials, we will figure out how to install and configure Nginx in reverse proxy server mode.
Deploy two test sites on different ports.