Hi all,
I have tried installing, reinstalling and modifying my settings so many times now that I'm about to give up. I just can't seem to get this to work as expected, or at all even.
I already have Nextcloud running since two years back (using the official plugin) and I am using Nginx Proxy Manager to access it and some other servers from the outside. Setting it up back then was a breeze, including getting it to work through Nginx reverse proxy. Same thing with the other servers I am using. No matter if they use HTTPS or HTTP between them and Nginx Proxy Manager, it just works...
So I thought this would be an easy ride, especially with everyone else seemingly being able to make it work without a hitch.
My current setup with the plugin:
TrueNAS : IP 192.168.1.38
Nextcloud : NATed on truenas with port 8283 for HTTPS towards Nginx.
Nginx Proxy Manager (IP 192.168.1.18) - Host setup with myddns.example.com, 192.168.1.38 and port 8283
Nextcloud config.php has trusted proxies (Nginx internal IP).
I'm perfectly fine having the new install running with an IP separate from TrueNAS. I'd prefer DHCP but I suppose that is possible to change later by editing the jail once it's up. I have made myddns2.example.com available and set it up in Nginx towards Host Nextcloud2 being set up with the script, using IP 192.168.1.37.
I would also like to be able to select which ports to use for accessing nextcloud, is that possible using the script??
I have tried installing with SELFSIGNED_CERT and I have tried installing with NO_CERT. I have tried installing with HOST_NAME="192.168.1.37" as well as "myddns2.example.com".
The closest I have come to making it work was with NO_CERT and the internal IP as HOST_NAME. This way I was able to login and use Nextcloud from the LAN. But trying to access it via myddns2.example.com gave me a completely empty white page (nothing). Tried from multiple browsers and via VPN as well from the phone (not connected to wifi), with the same result. Setting any other port than 80 in Nginx renders the "502 Bad gateway" error.
Rerunning the script again changing to SELFSIGNED_CERT made it possible to access via HTTPS internally but now Nginx gave "502 Bad gateway" no matter which port I chose.
Installing from scratch with HOST_NAME="myddns2.example.com" won't allow me to access nextcloud at all, from anywhere, regardless of how I try.
I have been fiddling with trusted domains and trusted proxies and added pretty much everything I can think of (for both), including my PC's IP, Nginx internal IP as well as myddns2.example.com.
The Caddyfile seems to allow adding multiple "domains" and just now as I'm writing this, I tried adding some more, including adding the port to the domain listing:
myddns.example.com, 192.168.1.37, 192.168.1.37:443,
192.168.1.18:8283 {
root * /usr/local/www/nextcloud
file_server
.... etc etc
Now I'm able to select port 443 OR 8283 in Nginx and it "works" but not completely.
If I enter 192.168.1.37/login, I get an unsecure connection
https://192.168.1.37/login and the nextcloud login page, completely internal.
If I enter 192.168.1.37 it changes to myddns2.example.com
/login . Clearly there is communication going on, since it adds the /login extension to the URL and it does show a secure connection (through Nginx with letsencrypt certificate as expected), but there is literally nothing on the page (verified using dev tool in browser).
Entering only myddns2.example.com also gives me the empty page but it stays like that without the /login extension.
Clearly this must have something to do with Caddy? Or am I missing something in the nextcloud configuration?
nextcloud-config for install has nothing more than the following: (current install with ddns and selfsigned cert).
JAIL_IP="192.168.1.37"
DEFAULT_GW_IP="192.168.1.1"
POOL_PATH="/mnt/TruePool"
TIME_ZONE="Europe/Stockholm"
HOST_NAME="internal IP" OR
"myddns2.example.com"
NO_CERT=0 OR
SELFSIGNED_CERT=1
COUNTRY_CODE=SE
CERT_EMAIL="
mymail@gmail.com"