Nextcloud on Shared Hosting: Performance Tuning Despite Shared Resources

Learn how to optimally set up Nextcloud on shared hosting and maximize performance with caching, PHP settings, and database tuning.

Nextcloud on Shared Hosting – A Challenge?

Nextcloud is a powerful cloud solution that often runs on dedicated servers or VPS. However, you can also run Nextcloud on shared hosting – with the right performance tuning. In this article, we show you how to achieve smooth usage despite shared resources.

Basic Optimizations

1. PHP Version and Settings

Ensure your shared hosting supports PHP 8.1 or higher. Enable OPcache for faster script execution. Adjust memory_limit to at least 512 MB and max_execution_time to 300 seconds.

2. Use Caching Systems

Install and activate Redis or APCu for caching files and sessions. Many shared hosting providers offer Redis – just ask. Configure the config.php accordingly:

'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],

3. Database Optimization

Use MariaDB or MySQL with InnoDB. Optimize tables regularly and set innodb_buffer_pool_size to 70% of available RAM (if possible). Use the Nextcloud command line for maintenance tasks.

File and Cache Configuration

1. Local File Cache

Enable the file cache in Nextcloud to speed up repeated read operations. Set in config.php:
'filelocking.enabled' => true,
'memcache.locking' => '\OC\Memcache\Redis',

2. Cron Job Instead of AJAX

Disable AJAX cron and use a system-wide cron job (e.g., every 15 minutes). This reduces web requests and improves response time.

Additional Tips for Shared Hosting

  • Enable Compression: Use Gzip compression for CSS, JS, and HTML.
  • Disable Image Previews: Turn off previews for large files if not needed.
  • Reduce Plugins: Remove unnecessary apps to save memory and CPU.
  • Minimize Logging: Set log level to Warn or Error.

Benefit from Our Web Hosting

Want to run Nextcloud without performance concerns? Our Web Hosting Packages offer optimized PHP environments, Redis support, and fast SSDs. Perfect for Nextcloud!