September 23, 2026 · by Alex M.
Nextcloud is one of the most powerful open-source platforms for file storage and team collaboration. Unlike Google Drive or Dropbox, Nextcloud runs on your own server — which means you retain full control over your data, with no third party involved. On an SSD VPS running Ubuntu 22.04, the installation takes less than an hour and delivers a fully functional private cloud with calendar, contacts, and online document editing.
This guide walks you through every step: server preparation, software stack installation (Nginx + MariaDB + PHP 8.2), HTTPS configuration, and essential performance tuning.
Commercial cloud services come with well-known trade-offs: limited free-tier storage, questionable privacy policies, and rising costs as your data grows. Running Nextcloud on a NVMe VPS gives you:
Before you start, make sure you have:
cloud.yourdomain.com)If you don't have a server yet, you can spin up a SSD VPS at CLIQHOST and be online within minutes.
Connect to your VPS via SSH and update packages:
sudo apt update && sudo apt upgrade -y
sudo hostnamectl set-hostname cloud.yourdomain.com
Verify the hostname:
hostname -f
Nextcloud works excellently with Nginx as the web server:
sudo apt install nginx -y
sudo systemctl enable --now nginx
Check the service status:
sudo systemctl status nginx
If UFW is active, allow HTTP and HTTPS traffic:
sudo ufw allow 'Nginx Full'
Nextcloud requires a relational database. MariaDB is the recommended choice for performance and compatibility.
sudo apt install mariadb-server -y
sudo systemctl enable --now mariadb
sudo mysql_secure_installation
During mysql_secure_installation, set a strong root password and answer Yes to all security prompts.
Now create the Nextcloud database and user:
sudo mysql -u root -p
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'VerySecurePassword123!';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Nextcloud requires PHP with several extensions. Add the Ondrej PPA repository and install:
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install php8.2 php8.2-fpm php8.2-mysql php8.2-xml php8.2-gd \
php8.2-mbstring php8.2-curl php8.2-zip php8.2-intl php8.2-bcmath \
php8.2-imagick php8.2-redis php8.2-apcu php8.2-cli -y
Edit the PHP-FPM configuration file:
sudo nano /etc/php/8.2/fpm/php.ini
Modify or add these values:
memory_limit = 512M
upload_max_filesize = 1G
post_max_size = 1G
max_execution_time = 300
date.timezone = Europe/Chisinau
opcache.enable = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 10000
opcache.revalidate_freq = 1
Restart PHP-FPM:
sudo systemctl restart php8.2-fpm
Download the latest stable Nextcloud release:
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.zip
sudo apt install unzip -y
unzip latest.zip
sudo mv nextcloud /var/www/
sudo chown -R www-data:www-data /var/www/nextcloud
sudo chmod -R 755 /var/www/nextcloud
Create a data directory outside the document root:
sudo mkdir -p /var/nextcloud-data
sudo chown -R www-data:www-data /var/nextcloud-data
Create a new virtual host file:
sudo nano /etc/nginx/sites-available/nextcloud
Add the following configuration (replace cloud.yourdomain.com with your actual domain):
upstream php-handler {
server unix:/var/run/php/php8.2-fpm.sock;
}
server {
listen 80;
server_name cloud.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name cloud.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/cloud.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cloud.yourdomain.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
root /var/www/nextcloud;
index index.php index.html;
client_max_body_size 1G;
fastcgi_buffers 64 4K;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
location = /robots.txt { allow all; log_not_found off; access_log off; }
location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; }
location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; }
location / {
rewrite ^ /index.php;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; }
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(?:$|/) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
expires 6M;
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
try_files $uri /index.php$request_uri;
access_log off;
}
}
Enable the site and test the configuration:
sudo ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/
sudo nginx -t
Install Certbot:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot certonly --nginx -d cloud.yourdomain.com
Verify automatic renewal:
sudo certbot renew --dry-run
For business use requiring a commercial certificate (OV/EV), CLIQHOST offers a full range of SSL certificates.
Restart Nginx:
sudo systemctl restart nginx
Open https://cloud.yourdomain.com in your browser. You'll see the Nextcloud setup wizard.
Fill in the fields:
/var/nextcloud-datancusernextcloudlocalhostClick Install and wait 2–3 minutes.
Nextcloud recommends cron over AJAX for background jobs:
sudo crontab -u www-data -e
Add the line:
*/5 * * * * php -f /var/www/nextcloud/cron.php
Then go to Settings → Administration → Background jobs and select Cron.
Redis significantly speeds up Nextcloud, especially with multiple concurrent users:
sudo apt install redis-server -y
sudo systemctl enable --now redis-server
Edit config.php:
sudo nano /var/www/nextcloud/config/config.php
Add to the configuration array:
'memcache.local' => '\OC\Memcache\APCu',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],
Add to /etc/nginx/nginx.conf inside the http {} block:
gzip on;
gzip_types text/plain application/xml application/json text/css application/javascript;
gzip_min_length 1000;
In Nextcloud Apps, install Two-Factor TOTP Provider and enable it for the admin account.
Create a Nextcloud filter:
sudo nano /etc/fail2ban/filter.d/nextcloud.conf
[Definition]
failregex = ^{"reqId":".*","level":2,"time":".*","remoteAddr":"<HOST>","message":"Login failed.*"}
^{"reqId":".*","level":2,.*"message":"Trusted domain error.*"}
ignoreregex =
Add the jail to /etc/fail2ban/jail.local:
[nextcloud]
enabled = true
port = 80,443
protocol = tcp
filter = nextcloud
logpath = /var/nextcloud-data/nextcloud.log
maxretry = 5
bantime = 3600
sudo systemctl restart fail2ban
Nextcloud provides a free online scanner at scan.nextcloud.com — enter your URL to get a detailed security report.
| Problem | Likely Cause | Fix |
|---|---|---|
| 413 Request Entity Too Large | client_max_body_size too small |
Increase value in nginx.conf |
| Nextcloud is slow | No cache (APCu/Redis) | Enable memcache.local |
| "Trusted domain" warning | IP/domain not listed | Add to trusted_domains in config.php |
| Cron not running | Wrong permissions | Check crontab -u www-data -l |
| 502 Bad Gateway | PHP-FPM stopped | sudo systemctl restart php8.2-fpm |
If server management feels overwhelming, CLIQHOST offers managed server administration — our team handles configuration, monitoring, and maintenance for you.
Nextcloud on a Linux VPS gives you a complete private cloud — file storage, calendar, contacts, and collaborative document editing — without surrendering control of your data to third parties. The Nginx + MariaDB + PHP 8.2 + Redis stack is stable and performant even for teams of 10–50 users.
For the best performance, a NVMe VPS from CLIQHOST provides fast NVMe storage, guaranteed resources, and 24/7 technical support. Have questions about your setup? Contact our team and we'll help you get running quickly.
Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.
"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."
"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."
"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."