I just came across the same issue and I used ports to achieve that.
This solution worked for me on a local machine and home network and probably works on any VPS without domain.
WEB SERVER 1
Open your firewall, example port 81
sudo ufw allow 81
Create your 1st web directory
sudo mkdir -p /var/www/web-folder-name1
Create test content in your web-folder
sudo nano /var/www/web-folder-name1/index.html
and paste any content here to test
Hello World 1!
Create a virtual host file in Nginx
sudo nano /etc/nginx/sites-available/web-folder-name1
and paste the following content
server {
listen 81; # the port is important
server_name _; # underscore is ok as you don't have a domain
root /var/www/web-folder-name1;
index index.html;
}
Enable your web server
sudo ln -s /etc/nginx/sites-available/web-folder-name1 /etc/nginx/sites-enabled/
WEB SERVER 2
Open your firewall, example port 82
sudo ufw allow 82
Create your 2nd web directory
sudo mkdir -p /var/www/web-folder-name2
Create test content in your web-folder
sudo nano /var/www/web-folder-name2/index.html
and paste any content here to test
Hello World 2!
Create a virtual host file in Nginx
sudo nano /etc/nginx/sites-available/web-folder-name2
and paste the following content
server {
listen 82;
server_name _;
root /var/www/web-folder-name2;
index index.html;
}
Enable your web server
sudo ln -s /etc/nginx/sites-available/web-folder-name2 /etc/nginx/sites-enabled/
Restart Nginx
sudo systemctl restart nginx
Test in your browser
127.0.0.1:81
127.0.0.1:82
# or
localhost:81
localhost:82
# or if you're on a network
static-ip:81
static-ip:82