Self-hosting Nextcloud
Nextcloud gives you the convenience of a cloud drive with none of the questions about where the data sits. On a dedicated server, the answer is: on a disk in Amsterdam that you control.
Nextcloud is a PHP application. It is only as fast as the stack under it, and the default tarball install on SQLite is where most of the “Nextcloud is slow” complaints come from. Put a real database and PHP-FPM under it from the start.
The stack that works
- PHP 8.3 with
opcache,apcuand theimagickextension — see tuning PHP-FPM - PostgreSQL or MariaDB, not SQLite — see database basics
- Redis for file locking and cache — see Redis and caching
- nginx or Apache in front with TLS from a real certificate
Give it memory and the right cache
The single biggest speed-up is APCu for the local cache and Redis for locking. In config.php:
'memcache.local' => '\OC\Memcache\APCu', 'memcache.locking' => '\OC\Memcache\Redis',
Then raise the PHP memory limit to at least 512M and set opcache.memory_consumption=256. The admin overview page tells you what is still missing — work until it is a clean sheet.
Where the files live
By default user files sit under data/ on the system disk. For anything beyond a few users, give that its own volume so a full data directory cannot take the OS down with it — see a disk that fills up. If you want S3-style storage, Nextcloud can use external object storage as its primary store; our own object storage article covers running that on the same box.
Big files and uploads
Chunked uploads need generous limits in both PHP and the web server. Set client_max_body_size high in nginx and post_max_size / upload_max_filesize to match in PHP, or large uploads fail at 50% with no clear error.
Back it up as two things
A Nextcloud backup is the database and the data directory, taken together. Restoring one without the other gives you a broken instance. Put the app in maintenance mode, dump the database, snapshot the files, then come out of maintenance — and test it, the way testing a restore describes.
Still stuck? Mail support@novogara.com — an engineer answers, at any hour. Back to the knowledge base