2 Servers, 2 Domains from the same public ip address

Hi all,

I have a general question regarding using nextcloud.

I am currently running the lastest release of nextcloud (20.0.0) on a ubuntu server 20.04 (nc1), from home accessbile from nc.example1.xxx. It works brillinatly, chuffed with it. I setup another nextcloud instance (latest release 20.0.0) on another physical ubuntu 20.04 server (nc2) and wanted to use it with another domain, example2.xxx, but from the same public ip (my home). However, I cant access it from the nc.example2.xxx domain, (It works fine from the local ip address). The servers are not on the same network. Im using a edgerouter x and have seperate networks running. 192.168.1.1/24 for nc1 and 192.168.2.1/24 for nc2. After a few hours of trying im guessing that I can do it. Would that be correct?

The A records are set up correctly and dns resolves to the correct public ip. I thought that the nc1 maybe interfering with nc2 so i shutdown nc1 but i get the same result.

I followed the same guide to setup both instances. I know that i can run two sites from the one server but i wanted to keep them independant of each other. Its for personal use.

So to be clear - nc1 - nc.example1.xxx - 192.168.1.2 works.
- nc2 - nc.example2.xxx - 192.168.2.2 doesnt work.

nslookup resolves correctly on both domains, i can ping them both fine.

what am i missing?

Ive added the domain to the trusted_domains config.php file.

DNS is through digitalocean hositng which is where both websites reside.
Domain registrar is with the same company and prior to yesterday the nc2 was at a different location working fine from example2.xxx.

Any help would be appreciated, I’ve looked on the forum but there doesnt seem to be any other topic related to mine.

Regards

jon_e5

I think you need a reverse proxy. Search the web for reverse proxy and nextcloud.

1 Like

Thanks for the reply, ill look into it today and report back.

1 Like

What you need here is called SNI Routing. SNI adds the server name in the inital SSL Hello request. It is by using that SNI name that a proxy can figure to which server it must send the request. Here, I do SNI Routing using HAProxy in my frontend pfSense firewall.

Thanks for the info, ill check it out.

So this is not really a nextcloud issue. Ill close it off.