It’s been a while since we wrote something about the Nextcloud VM. In our latest post, we wrote about the decision to separate the OS and the data drive since we now are using ZFS for the data mount and some other major changes due to the fact that Ubuntu 18.04 was released.
Since then a few other things have improved as well. One of the biggest changes was that we moved to PHP-FPM instead of using the “regular” Apache module for PHP. The reasons are many, but the most important reason is that it’s faster, much faster. It’s also better because it’s easier for experienced sysadmins to fine-tune it, which was requested by a number of users in the past.
In our tests, the GUI feels much snappier due to that there are PHP workers already waiting for incoming connections and they don’t need to be spawned on each request. When it comes to syncing with any of the Nextcloud clients the result is somewhat better as well.
We hardcoded some of the PHP-FPM values based on the amount of RAM that the VM is released with which currently is 2 GB, but the max_chidren setting is dynamically set depending on how much RAM that is available if you choose to increase the amount of RAM in your setup. That means that the bare minimum amount of workers is available to you if you don’t change anything, but if you do want to change it, it’s easily done in /etc/php/7.2/fpm/pool.d/nextcloud.conf which currently looks like this if you choose to go with the defaults:
[Nextcloud] user = www-data group = www-data listen = /run/php/php7.2-fpm.nextcloud.sock listen.owner = www-data listen.group = www-data pm = dynamic ;; max_children is set dynamically with calculate_max_children() pm.max_children = 8 pm.start_servers = 3 pm.min_spare_servers = 2 pm.max_spare_servers = 3 pm.max_requests = 500 env[HOSTNAME] = cloud env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp request_terminate_timeout = 3600 security.limit_extensions = .php php_admin_value [cgi.fix_pathinfo] = 1
If you do choose to increase your RAM the values you should change to get an even snappier and faster VM is the bold values above. But please keep in mind, be careful as there’s a big risk of that the server won’t work properly if you do it the wrong way. You can always ask for support if you don’t know how it should be done.
Before Ubuntu 18.04 we made it an option to install and use HTTP/2 if you were installing your VM with the scripts from start. Now it’s default so that all connections through your VM uses HTTP/2. Pretty neat if you ask us.
Since mcrypt is deprecated in the later version of PHP, and that phpPgAdmin doesn’t work with later versions of PostgreSQL + that it’s considered (by many blogs we read at least) to be somewhat insecure, we decided to look elsewhere. That’s when we found Adminer and implemented that instead of phpPgAdmin. It’s just a single PHP file and comes with several plugins if you choose to install them. In other words, it’s easy to maintain and it’s secure. Though, it will break HTTP/2 so only install it if you really need it.
Other than that we made several smaller improvements and we always keep improving the scripts, making them more stable and easier to use. If you are interested in all the changes, please check out the release page on Github where we keep a small changelog of what’s changed.
In the next release, we will make it possible to set static IP directly at the beginning of the first setup script for all of the users without DHCP. That’s a major change that has been requested for some time now.
We also plan to add a GUI so that instead of using the console, you just visit your IP address for the VM and you will be presented with a Web GUI wizard instead of plain and technical CLI. That change will take some time though since we need to hire PHP devs to develop that for us.
If you have any suggestions that you think would improve the VM, please let us know. It’s also very important that you let us know about bugs in the code. If we don’t know they exist, we can’t fix them. :)
As usual, happy Nextclouding!