Nextcloud on Shared Hosting: Setup with SSL and Performance Tuning
Learn how to set up Nextcloud on shared hosting, enable automatic SSL encryption, and optimize performance for small teams – including tips for choosing the right hosting.
Why Nextcloud on Shared Hosting?
Nextcloud is an excellent solution for small teams that want to self-host their data. Shared hosting is cost-effective and easy to manage – ideal for getting started. With the right settings, you can run a performant and secure Nextcloud instance on a shared server.
Prerequisites
- A shared hosting package with PHP 8.0+, MySQL/MariaDB, and support for .htaccess
- A domain pointing to your hosting
- SSH access (optional but helpful)
Step-by-Step Guide
1. Download and Install Nextcloud
Download the latest Nextcloud version from the official website. Extract the files into the desired directory of your hosting (e.g., public_html).
2. Set Up Database
Create a new MySQL database and a user with all privileges via your hosting control panel. Note down the credentials.
3. Installation via Browser
Access your domain – the Nextcloud installation wizard will start. Enter the database details and an admin account. Choose a “data directory” outside the web root if possible.
Automatic SSL Encryption
Most modern shared hosting providers offer free SSL certificates via Let's Encrypt. Enable SSL in your control panel (often under “SSL/TLS” or “Security”). Ensure all HTTP requests are redirected to HTTPS. Add the following lines to the .htaccess file in the Nextcloud directory:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]Performance Optimization for Small Teams
Caching
Enable Nextcloud's built-in caching. Open config/config.php and add:
'memcache.local' => '\OC\Memcache\APCu',
'filelocking.enabled' => true,
'memcache.locking' => '\OC\Memcache\APCu',APCu is available on most shared hostings. Ask your hoster if needed.
PHP Settings
Increase the PHP memory limit to at least 512 MB. Create a .user.ini file in the Nextcloud directory:
memory_limit = 512M
upload_max_filesize = 2G
post_max_size = 2G
max_execution_time = 3600Database Optimization
Use MariaDB instead of MySQL if possible. Regularly run OPTIMIZE TABLE on Nextcloud tables.
Common Issues and Solutions
- 502 Bad Gateway: Restart PHP-FPM or increase timeout.
- Slow Uploads: Check PHP values for
upload_max_filesizeandpost_max_size. - SSL Errors: Ensure the certificate is valid and all assets are loaded over HTTPS.
If you are looking for reliable shared hosting for your Nextcloud project, check out our Webhosting packages – they offer optimal conditions for your cloud.