Hi all. I would like to run Nextcloud behind an Apache web server set up as a reverse proxy. Both Nextcloud and Apache will be running on the same computer accessible on the web via it’s ip address since I’m just practicing for now. My configuration is a VPS running Ubuntu 20.04LTS and Nextcloud installed via SNAP, version 126.96.36.199. Let’s say the ip address of the vps is x.x.x.x and when I type that it, I’m greeted with the Nextcloud login screen.
Next I set Nextcloud to listen on port 444 and enabled https with a self signed certificate. I can still access Nextcloud with a few warnings. Now I want to set it up to be behind the Apache reverse proxy. I’ve tried various combinations of settings learning what I could from other posts but thought it might be time to ask some questions, specifically about what needs to be done in Nextcloud’s config.php.
Should I add localhost to trusted_domains and trusted_proxies?
0 => ‘x.x.x.x’,
1 => ‘127.0.0.1’,
0 => ‘127.0.0.1’,
And for the parameters found in the documentation (with questions after the parameters):
‘overwritehost’ => ‘x.x.x.x’, (Should this be the ip address as seen from a browser? I don’t have a DNS record for this machine.)
‘overwriteprotocol’ => ‘https’,
‘overwritewebroot’ => ‘/’,
‘overwritecondaddr’ => ‘^x.x.x.x$’, (This represents the address that the browser used to reach the Apache proxy, correct?)
‘overwrite.cli.url’ => ‘http://x.x.x.x’, (Is this even needed with the latest version of Nextcoud? If so, is this correct?
The Apache virtual hosts file:
ProxyPreserveHost On ProxyPass / https://localhost:444/ ProxyPassReverse / https://localhost:444/
I know more has to be done with the virtual host, for webDAV and calDAV, but shoudln’t this get me to a login screen? Or instead of localhost:444 shoud I be using x.x.x.x:444/ ?
I’d appreciate any feedback you may have. Thank you.