Just a quick note about some reverse proxy settings that helped me get Nextcloud working properly. I have run a Nextcloud instance for the past couple of years, but I've never managed to get reverse proxying exactly right. I run an Apache webserver as a front end to all my web applications because that's the first webserver I learned…and I spent 10mins looking at NGINX, Caddy, Traefik etc and decided I couldn't be bothered if my setup was working fine anyway.
I consistently got a message from Nextcloud that my reverse proxy settings were misconfigured. I had all connections forwarded correctly from the reverse proxy so that all functionality was correct…but Nextcloud was receiving all traffic as the ip of the reverse proxy rather than the place it originated from. The Nextcloud instructions found here are not particularly helpful in this.
I decided to look into it and found that I had everything configured correctly for my reverse proxy, but that I needed to do a bit of configuring on the Nextcloud container backend also running Apache to serve the content. I found this explainer at globo.tech which showed me how. Essentially you need to load the
remoteip mod with the
a2enmod command, and then create the following file;
$ sudo nano /etc/apache/conf-available/remoteip.conf
and add this to the file;
RemoteIPHeader X-Forwarded-For RemoteIPInternalProxy <ip address of your reverse proxy>
Then restart apache with;
$ sudo systemctl restart apache2
and you should be good to go. The guide linked above gives some extra information about how to log the ip addresses connecting to the Nextcloud instance that is probably worth looking at too.
This was suitable for me as I connect to my Nextcloud instance from within my network. If you have an instance hosted on a VPS or remotely, it may be more suitable that you use the
RemoteIPTrustedProxydirective instead of
Make sure that you are configuring the backend apache server with these instructions, the frontend reverse proxy configuration is easy enough the find online.
This guide taught me an awful lot about reverse proxies, it's worth checking out if you're unsure.
That pretty much solved my issue. I'll update the post if I found that anything has broken and I have to fix that!