I have two machines, each have a unique local address (192.168.1.2 and 192.168.1.3) and ipv6 too.
i have a few sites running on each machine (different apps and domains)
I thought that using nginx and listen on 192.168.1.2 for sites of machine 1 and 192.168.1.3 for sites on machine2 i could have them working using only one nginx routing. I do this because my router can only deal with routing requrest for port 53, 25, 80, 443 to one machine. I thought that i would use machine 1 to route the incoming requests and machine two to server the apps on the local address 192.168.1.3.
I have set a reverse proxy on nginx with 192.168.1.3 of machine2 although the apps work when i request http://192.168.1.3 in the browser, the nginx reverse is not working.
I thought maybe adding a new interface within machine 1 that listen on 192.168.1.3 would work, but i dont know if its possible.
Just to sum up my configuration:
-One router with one public ip
-Two machines behind (with same public ip), and unique local ips (192.168.1.2 and 1.3. + ipv6)
-Router rules routing ports to machine1.
Sorry if i didnt explain well enough and thank you for your answer.
Ill try to simplify my situation:
I have two physical machines.
Each machine is running a website, because each website need a certain amount of ram and cpu, so each machine provide it for each website.
machine1 is 192.168.1.2 and machine2 is 192.168.1.3.
Router can only forward incoming connections to either machine1 or machine2.
So i set machine1 to handle it, i installed virtualmin on it.
Machine1 handles Dns, nginx and mail.
Machine1 serves website1 on http://192.168.1.2 on port 80 + 443
Machine2 serves website2 on http://192.168.1.3 on port 80 + 443
I created a two nginx sites conf for each website on machine1 with a proxy_pass directive:
As @ID10T says, you do not need to proxy websites1.
You do need to proxy website2 because it is on a second pc.
I have not done proxying before or used nginx. But if you want to access website2 from the Internet you need to have the domain for website2 configured on pc1(virtualmin) to proxy pass to website2. You do not need all of the files and databases from website2 on your virtualmin pc, just virtual server with the correct proxy pass rules.
Get website1 working on the internet before fixing website2
If it’s a web app running in pretty much any app server other than PHP-FPM or if it is a containerized app, they need to proxy to it, regardless of what machine it’s on.