-1

I have a raspberry pi at 192.168.0.130 hostname pi (running 64 bit ubuntu server or raspberry pi os)

It has 2 dynamic node websites website1 and website2 running on ports 5501 and 5502

Is there a way for me to access them like website1.pi.local and website2.pi.local on my local network using nginx?

preferably by editing only the nginx config.

aryan chavan
  • 1
  • 1
  • 2

1 Answers1

0

The simplest solution to be able to access both websites would be to run them on different ports. This would allow accessing them e.g. via 192.168.0.130:8080 and 192.168.0.130:8081.

What you are asking for with two different domains is a bit tougher and requires DNS modifications, which you could do e.g. by editing /etc/hosts on your machine (not on the server) like this (or possibly on your router / DNS resolver):

192.168.0.130 website1.pi.local
192.168.0.130 website2.pi.local

and after that using nginx config to separate the two domains like this:

server {
  server_name website1.pi.local;
  …
}

server {
  server_name website2.pi.local;
  …
}
rauberdaniel
  • 141
  • 5