Scripted installation of Nextcloud 29 in iocage jail

There are a number of guides on the (old) forum to install Nextcloud, but they all rely on a lot of manual work. Where there’s manual work to be done, there are ways to get it wrong. Therefore, this guide is designed to minimize manual work–all that’s really needed is to download the script, set up a small configuration file, and run the script–it will do the rest of the work. And by “the rest of the work”, I mean that it will create the jail, download Caddy 2.7.6 (as of this writing), PHP 8.3, MariaDB 10.6 (or PostgreSQL if desired), and the latest Nextcloud 29 release; configure all of them; obtain and install a trusted TLS certificate for the jail (if desired); and automatically renew the certificate.

The most up-to-date instructions will be at

3 Likes

Thanks for helping port these over @dan! We really appreciate it.

@dan any thoughts on replacing Redis?

Personally I’m thinking about breaking out MariaDB and maybe KeyDB into its dedicated jail as I have multiple applications using them.

1 Like

Not as yet, though I’m aware of the kerfuffle. I think I’d want to wait for the dust to settle a bit before making any changes.

As to the database, I like the concept of having it in a separate jail, but I’m concerned that overly complicates setting up the jail. Great idea for a manual setup, but I’m not sure how well it would work for a scripted installation.

I installed Nextcloud using this script last year. The other day I updated Nextcloud to 29.0 through the UI and broke Security and Setup warnings. I’m using the self signed cert method because I’m using HAProxy and LetsEncrytp on pfSense.

NotAuthenticated
No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured
ConnectException
cURL error 28: Failed to connect to nextcloud.my-domain.com port 80 after 10039 ms: Timeout was reached (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for nextcloud.tunnel-home.us/.well-known/caldav
Can not connect to local server for running setup checks

are the errors I believe to be relevant. Any idea where I need to start looking or what to change?

You can’t connect to Nextcloud with LetsEncrypt certificate over port 80.
You need to setup HAProxy on pfSense to handle ssl/https transaction to happen on port 443.

HAProxy is set up using 443. I’m thinking maybe Nextcloud should be trying to check it’s self using “localhost” vs. nextcloud.my-domain.com. It worked before I updated Nextcloud so it has to be something trivial.

How do I go about wiping nextcloud and re-running the script for a fresh install without losing any of my data?

I usually rename my old jail, then run the script again overtop of my existing data.

If everything goes ok, I delete the old jail.

Funny enough, i am running the same set up and i also experienced some issues after upgrading to NC29. After doing the initial install of NC28 using Dan’s script (with noSSL as this is handled by pfSense), HAproxy was acting up and i couldn’t get access through the FQDN where i had no problem getting access through the local IP. I fixed it at the time by changing the backend from port 80 to 443 which seemed unlogical at the time but worked. After upgrading, that didn’t work anymore and i changed it back to port 80 and all was well again.