Two nextcloud instances on one server, with a shared data directory

Nextcloud version : 13.0.4
Operating system and version : Ubuntu Server 18.04
Apache or nginx version : nginx 1.15.1
PHP version : 7.2.7

Hey there,

I’ve been setting up nextcloud behind a restrictive ISP, that forces me to use a VPN.
Therefor I was unable to access from outside my LAN, without setting:
‘overwritehost’ => ‘’,
‘overwriteprotocol’ => ‘https’,
‘overwrite.cli.url’ => ‘’,
If there is any other way this would be helpful, although not directly my question.

Having done this I can no longer access nextcloud through my LAN connection, which is a real problem, since the speeds through the VPN are not that great.
I was hoping for a way to set basically two instances of nextcloud up, which share a common data directory, but have slightly different config.php files, so that I can access one instance through the VPN and the other one through my local connection.
Unfortunately I’m quite new to the management of Servers - till now I’ve only had some experience with ubuntu -, but I want to learn.

So can someone outline the steps required for this solution, or point me towards a better one, because after some googling I came up with nothing really useful.

Thanks in advance