ownCloud + Nextcloud: Large rework completed

Hey guys,

we recognized that many of you use ownCloud and Nextcloud on your DietPi. Thus we started to do a great rework of their automated installation and configuration to offer you the best optimized ready to use instances. You can follow the progress on github: https://github.com/Fourdee/DietPi/issues/1067

The rework includes:

  • Optimized PHP settings to suppress warnings on web ui admin panel.
  • Optimized Apache and Nginx configuration, selective for your instance subdirectory.
  • Usage of Redis server for transactional file locking.
  • Configure system cron to schedule ownCloud/Nextcloud cron jobs.
  • Shortcuts for occ commands: Simply type ‘occ’ on ownCloud and ‘ncc’ on Nextcloud, withoutsudo -u www-data php /var/www/*cloud/’.
  • 4-byte character support on database, to allow storing of emojis inside apps.
  • Automated appliance of maintenance:mode on DietPi’s maintenance tasks.
  • Ongoing improvements are planned.

The majority of the rework is done, with the second Phase implemented and fixed with DietPi v159. The DietPi updater will schedule an automated reinstallation of both, if installed. Don’t worry about your data and in case manual webserver and/or ownCloud/Nextcloud configurations. All data will remain and existing configuration will be touched carefully to implement optimisations without destroying manual adjustments.
But as we want to be careful, we are not able to include all the changes we made into existing instances.
Thus if you want to enjoy the total set of improvements, simply uninstall ownCloud/Nextcloud via dietpi-software and install it again afterwards. Configurations, including selective webserver config files, will be removed that way, but your data will stay in place and your database will be dumped into the userdata folder. Afterwards, install the instance again and directly restore the nextcloud/owncloud database backup to fully restore all data inside your instance.


  • Even that DietPi automatically creates a MySQL/MariaDB backup, we recommend to please always do a manual backup of database and datafolder by yourself, before doing significant changes. You may want to use ‘dietpi-backup’, or in scheduled way ‘dietpi-sync’ for this.
  • Read the MariaDB instructions on how to dump and restore the database: https://mariadb.com/kb/en/library/backup-and-restore-overview/. This is valid for MySQL databases as well.

Review, feedback and feature requests from you are highly appreciated. You may wan’t to use this thread or directly file an issue on github: https://github.com/Fourdee/DietPi/issues

Awesome…I have a working install of Nextcloud (between my wife and my phones have like 24GB already stored on the drive)…will definitely be doing this method…

My v159 update went like a champ without a hitch

Thanks for the hard work and keeping with the updates and software! Great job!

Thanks for the nice feedback! If there is any question or any wish, just ask. I am perfectionist, which means that I will practically never stop to improve this and also improve the way of implementing new features as smooth as possible :smiley:.

I have set up an owncloud instance on my Raspberry Pi Zero W. Works well with Lighttpd. However, I am struggling with a couple things.

First, it is not clear how to enable SSL on my owncloud server. CertBot is designed for Apache and Nginx, it seems. I cannot find a tutorial that explains how to set up SSL in my instance (Dan says one that exists on this forum is outdated/not needed).

Second, while I can access my owncloud via a specific open port on my router IP address, as soon as I try do the same with a domain name, I get as far as the generic Lighttp page (my.domain.com). Note my URL redirect on afraid.freedns.org points my.domain.com to XXX.XXX.XXX.XXX:PPPP. As soon as I add /owncloud/ to the domain URL I am presented a blank page (my.domain.com/owncloud). This does not happen when I type in the actual IP address e.g. XXX.XXX.XXX.XXX:PPPP/owncloud. Obviously I failed to configure something. I edited /var/www/owncloud/config/config.php so that both my Raspberry Pi, router IP address, and my.domain.com are seen as trusted domains. Any advice would be appreciated.

Thanks in advance.

To enable SSL, no matter if Apache, Nginx or Lighttpd is used, install CertBot and run dietpi-letsencrypt to configure it. CertBot itself brings automated webserver configuration modules for Apache and Nginx only. But it allows to use any existing webserver or even it’s own standalone solution, so verify the domain and place the certificate+key. dietpi-letsencrypt then handles the installation of those into Lighttpd.

Just to be sure, so far now you don’t use SSL at all and access your ownCloud via http:// right?
Hmm, I am not sure how trusted domains handle custom ports, never tested this. But obviously it works since XXX.XXX.XXX.XXX:PPPP/owncloud works and as well ownCloud does not make a difference between 80 and 443 there, I guess ports are completely ignored anyway.

Does my.domain.com:PPPP/owncloud work?

Hi Michael

I am struggling here. I tried this command line:

./letsencrypt-auto certonly --webroot -w /var/www/owncloud/ -d my.domain.com

And get this error:

  • The following errors were reported by the server:

Domain: my.domain.com
Type: unauthorized
Detail: Invalid response from
[]: 403

It seems the permissions for /var/www/.well-known/ may be an issue? My A record in freedns.afraid.org for my.domain.com matches

I read that I may need to change a rewrite rule in .htaccess in /var/www/owncloud?

My feeling is that dietpi software configuration has an unresolved permissions issue. This should run out the box on a vanilla installation of dietpi using standard installation parameters. Owncloud works out the box, beautifully as http://my.domain.com:7053/owncloud/. I just want to to add SSL to secure it better.

Admittedly, I am not an expert in Linux! Your help would be appreciated.

OK, I figured out the problem. I needed to change my router admin port to 8080. The DNS was ending up at the router not the owncloud device. Silly me. Thanks for the assistance, Michael.