NextcloudPi behind a Caddy HTTPS reverse proxy?

I have a few websites already running, using Caddy, which does its own Let’s Encrypt HTTPS (and rather well, I may add). I’d like to add a Raspberry Pi with NCP, i.e. use Caddy as reverse proxy, just as I do with a few other services here.

Am running into a few issues, using a brand new install on RasPi3:

  • Caddy does HTTPS, so NCP will get all sessions on port 80, which it seems to refuse (wanting to do its own HTTPS, I assume?)
  • I get a request to set up NAT port forwards in my router, and a request to use DDNS, both of which are incorrect in my context, I believe.

So my question is: since I already have a functioning HTTPS entry point and don’t want to break that, how does one get started with NCP in this scenario? Is there an example, or a discussion to help figure out the proper setup? The Caddy server has been fully set up with a dedicated subdomain for this new NCP system.

FWIW, I’ve been using NC for years, but in a very basic / standard way. Am totally new to the NC-on-Pi build. I very much like the idea of a fully-configured NC which is actively supported and self-updating.

Any tips or pointers would be very much appreciated.

PS. I’ve set up an ssh file before first boot, but ssh login fails with “Could not chdir to home directory /nonexistent: No such file or directory”.

1 Like

I’m encountering the same scenario, did you find any solution in the months that passed since you posted?

Could you give an example of your Caddyfile if you managed to make it work?

Edit:
A possibile workaround is manually change /etc/apache2/ports.conf and /etc/apache2/sites-available/nextcloud.confto listen to ports (for example) 81 and 444 so that caddy can listen to 80 and 443 in the scenario where caddy and ncp live in the same host machine.
Then you can proxy your domain to the internal port https://ncphostip:444