If you followed my previous posts on configuring reverse proxies in the NGINX Proxy Manager container using Cloudflare and your own domain or the free Duck DNS service, you may have noticed your subdomain for the Nextcloud application still not working after following the outlined steps.
This is a recognized issue within NGINX Proxy Manager and stems from the application not supporting the ability to forward to an HTTPS backend or server.
Luckily there’s an easy workaround we can make until it is updated to support the functionality we need.
Editing Nextcloud’s Configuration File
Navigate to the application configuration/installation folder for NGINX Proxy Manager within your operating system and navigate to the “proxy_host” folder within the “nginx” folder.
If you’re using Unraid, the folder path will look something like the one below:
Open the folder and you’ll find a list of CONF files that are titled with what seem to be random numbers. Each of these files corresponds with the subdomains/proxy hosts you have set up within NGINX Proxy Manager – when a record is created, the application creates a CONF file for the record and stores it in this folder.
Open each CONF file until you find the corresponding file for Nextcloud. (In the screenshot above, “2” was the Nextcloud CONF file for me.)
Within the Nextcloud CONF file, find the following line:
and replace it with the following:
add_header X-Served-By $host; proxy_set_header Host $host; proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass https://$server:$port;
Save the CONF file and restart the Docker container.
The reverse proxy for Nextcloud should work properly after restarting the NGINX Proxy Manager container.
Note that every once in a while this configuration may be overwritten and the CONF file will need modified to re-enable the reverse proxy. The steps to do so will be the same as outlined above.
If you’re still experiencing issues or have any questions or feedback, feel free to leave a comment below.
If you’ve found this or any of the other posts on SHIFT14 helpful, please consider supporting the site through a one-time PayPal donation or ongoing support through Patreon. My goal is to continue providing in-depth guides for the technical community and the support helps justify the time and resources spent doing so.