This is an old revision of the document!
Nextcloud™
Optimized PHP Configuration
Key PHP Settings
PHP settings are typically found in php.ini
— /etc/php/8.x/fpm/php.ini
memory_limit = 512M ; Minimum recommended by Nextcloud; increase to 1G+ for heavy usage or large files. upload_max_filesize = 2G ; Set to match your largest expected file size (e.g., 2G for 2 GB). post_max_size = 2G ; Should match or exceed upload_max_filesize. max_execution_time = 300 ; Increase for long-running tasks like file uploads or cron jobs (300 seconds = 5 minutes). date.timezone = America/New_York ; Set to your server's timezone to avoid warnings. output_buffering = Off ; Nextcloud recommends disabling this to avoid issues with certain operations.
OPcache Settings (Performance Boost)
OPcache caches precompiled PHP bytecode, significantly speeding up Nextcloud. Add these to php.ini or a separate file like /etc/php/8.x/fpm/conf.d/10-opcache.ini
opcache.enable = 1 ; Enable OPcache. opcache.memory_consumption = 128 ; Memory for cached scripts (128 MB is a good starting point; increase to 256 MB if RAM allows). opcache.interned_strings_buffer = 8 ; Memory for string interning (8 MB is sufficient for most cases). opcache.max_accelerated_files = 10000 ; Max number of files to cache; adjust based on Nextcloud’s file count. opcache.revalidate_freq = 60 ; How often to check for file changes (60 seconds balances performance and freshness). opcache.save_comments = 1 ; Required by Nextcloud to preserve code comments in bytecode. opcache.enable_cli = 0 ; Disable for CLI to avoid unnecessary overhead in cron jobs.
Optional: JIT (PHP 8.0+)
For CPU-intensive tasks (e.g., image processing), enable the JIT compiler:
opcache.jit_buffer_size = 100M opcache.jit = tracing ; "tracing" mode offers the best performance for web apps like Nextcloud.
Solved Problems
mjs configuration error
Error description
Your webserver does not serve `.mjs` files using the JavaScript MIME type. This will break some apps by preventing browsers from executing the JavaScript files. You should configure your webserver to serve `.mjs` files with either the `text/javascript` or `application/javascript` MIME type.
Solution
Edit /etc/nginx/mime.types
application/javascript js mjs;
Remove configuration in nginx conf
# include mime.types; # types { # text/javascript js mjs; # }