Caddy Server & Nextcloud Docker Unraid setup - bad gateway 502

I am currently in a stuck position trying to get my external access setup for Nextcloud on my unraid server with a Caddy Server container.

Caddy is serving up all my other sites without issue, but with the example Caddyfile I gleaned from here: examples/Caddyfile at master · caddyserver/examples · GitHub
it is giving me a 502 bad gateway page.

Here is the section of my caddyfile and the current port layout I have.
I created an extra path in Caddy docker to point to the nextcloud folder so i can reference the root,log and error sections easily. other than that, the settings remain untouched.

My Caddy server is setup for the external ports 80 and 443 and nextcloud lives on 444 to container port 443. Any thoughts or directions would be helpful. While my other pages were easy to setup, this one has been a bit more of a challenge for me.

nextcloud.domain.com {

root   /nextcloud/www/nextcloud
log    /nextcloud/log/nextcloud_access.log
errors /nextcloud/log/nextcloud_errors.log

fastcgi / http://127.0.0.1:9000 php {
	env PATH /bin
}

rewrite {
	r ^/index.php/.*$
	to /index.php?{query}
}

# client support (e.g. os x calendar / contacts)
redir /.well-known/carddav /remote.php/carddav 301
redir /.well-known/caldav /remote.php/caldav 301

# remove trailing / as it causes errors with php-fpm
rewrite {
	r ^/remote.php/(webdav|caldav|carddav|dav)(\/?)$
	to /remote.php/{1}
}

rewrite {
	r ^/remote.php/(webdav|caldav|carddav|dav)/(.+?)(\/?)$
	to /remote.php/{1}/{2}
}

# .htaccess / data / config / ... shouldn't be accessible from outside
status 403 {
	/.htacces
	/data
	/config
	/db_structure
	/.xml
	/README
}

header / Strict-Transport-Security "max-age=31536000;"

}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.