Best VPS for Nextcloud (2025) — Self-Host Your Cloud Storage
Nextcloud is the most popular self-hosted alternative to Google Drive, Dropbox, and OneDrive. It gives you a full cloud storage platform — file sync, sharing, calendar, contacts, office documents, video calls — running on hardware you control. Your data stays in your jurisdiction, you pay no per-user licensing fees beyond hosting costs, and you can extend Nextcloud with hundreds of apps.
Running Nextcloud on a VPS is the standard deployment for individuals, families, and small teams who want cloud storage without the data exposure of commercial providers. The key is choosing a VPS with enough storage and RAM for your use case, then configuring the stack correctly for performance.
Nextcloud System Requirements (2025)
Nextcloud 29 (current version as of 2025) has the following requirements.
| Component | Minimum | Recommended |
|---|---|---|
| PHP | 8.1 | 8.2 or 8.3 |
| Database | MariaDB 10.6+, MySQL 8.0+, PostgreSQL 14+ | MariaDB 10.11 LTS |
| RAM | 512MB (light use) | 2GB+ for multiple users |
| CPU | 1 vCPU | 2+ vCPU for concurrent users |
| Web Server | Nginx or Apache 2.4+ | Nginx with PHP-FPM |
| Object Cache | Optional | Redis (strongly recommended) |
| Storage | Depends on your files | Plan for 2x your expected data volume |
The 512MB minimum applies to a single user with light activity. For practical personal use, 1GB RAM is the comfortable minimum. For families (3-5 users) or small teams (up to 10 users), 2GB RAM is recommended. PHP-FPM worker processes each consume 30-80MB RAM depending on installed Nextcloud apps.
Choosing Storage Size
Storage is Nextcloud's primary resource requirement, and it is different for everyone. Estimate your current and future needs before choosing a plan.
| Use Case | Users | Recommended Storage | VPS Plan |
|---|---|---|---|
| Personal (documents + photos) | 1 | 100-200GB | 2 vCPU, 2GB, 100GB NVMe |
| Family (photos + videos) | 2-5 | 500GB-1TB | 2 vCPU, 4GB, 500GB NVMe/HDD |
| Small team (work files) | 5-15 | 500GB-2TB | 4 vCPU, 8GB, 1TB storage |
| Organization | 15+ | 2TB+ | Dedicated server or S3 backend |
Note that NVMe SSD is overkill for primary file storage (binary files like photos and videos do not benefit from NVMe's IOPS advantage). For large storage volumes, a combination works well: NVMe SSD for the OS and database, and a larger HDD or object storage (S3-compatible) for the actual files. Nextcloud supports external storage backends including S3, so you can keep a small NVMe VPS and attach cheap object storage for data.
Installing Nextcloud on Ubuntu 22.04
Install PHP and Required Extensions
apt update && apt upgrade -y
apt install -y nginx php8.2 php8.2-fpm php8.2-common php8.2-mbstring php8.2-xmlrpc \
php8.2-soap php8.2-gd php8.2-xml php8.2-intl php8.2-mysql php8.2-cli \
php8.2-zip php8.2-curl php8.2-imagick php8.2-bz2 php8.2-bcmath \
php8.2-redis php8.2-apcu unzip wget
For a complete Nginx installation, see our Nginx on VPS guide.
Install MariaDB
apt install -y mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation
Create the Nextcloud database.
mysql -u root -p
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'strong-password-here';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Download and Install Nextcloud
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
tar -xjf latest.tar.bz2
mv nextcloud /var/www/nextcloud
chown -R www-data:www-data /var/www/nextcloud
chmod -R 755 /var/www/nextcloud
Configure Nginx for Nextcloud
nano /etc/nginx/sites-available/nextcloud
upstream php-handler {
server unix:/run/php/php8.2-fpm.sock;
}
server {
listen 80;
listen [::]:80;
server_name cloud.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name cloud.yourdomain.com;
root /var/www/nextcloud;
index index.php;
client_max_body_size 10G;
fastcgi_buffers 64 4K;
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_types application/json text/css text/plain text/xml;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ^~ /.well-known {
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
try_files $uri $uri/ =404;
}
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { deny all; }
location ~ ^\/(?:autotest|occ|issue|indie|db_|console) { deny all; }
location ~ \.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_max_temp_file_size 0;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/
certbot --nginx -d cloud.yourdomain.com
nginx -t && systemctl reload nginx
Nginx vs Apache for Nextcloud
Nextcloud officially supports both Nginx and Apache. Nginx is generally recommended for VPS deployments for several reasons. Nginx handles concurrent connections more efficiently with lower memory overhead. PHP-FPM (which manages PHP worker processes) integrates cleanly with Nginx via Unix socket. Nginx's event-driven architecture handles slow clients (mobile devices on cellular) more gracefully than Apache's process-per-connection model.
Apache is slightly easier to configure for Nextcloud because the official documentation and installer assume Apache, and the .htaccess files in Nextcloud's source work natively with Apache. For experienced sysadmins, Nginx is the better choice for performance.
Performance Tuning
PHP-FPM Configuration
Edit the PHP-FPM pool configuration for better performance under load.
nano /etc/php/8.2/fpm/pool.d/www.conf
; Number of PHP workers
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 500
Set pm.max_children based on available RAM. Each PHP-FPM worker uses approximately 50-80MB RAM. For a 2GB VPS with ~1.5GB available for PHP: 1500 / 65 ≈ 23 workers maximum. Leave headroom for the database and other processes.
PHP OPcache Configuration
OPcache compiles PHP files once and caches the bytecode in memory, eliminating repeated compilation overhead. This is the single most impactful PHP performance optimization.
nano /etc/php/8.2/fpm/conf.d/10-opcache.ini
opcache.enable=1
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
Redis Object Cache
Redis dramatically improves Nextcloud performance by caching database queries and session data in memory. Without it, every file list request and file access operation requires multiple database queries.
apt install redis-server php8.2-redis -y
systemctl enable redis-server
systemctl start redis-server
Configure Nextcloud to use Redis. Edit /var/www/nextcloud/config/config.php and add.
'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
],
Enabling Redis object caching reduces Nextcloud's TTFB (Time to First Byte) by 30-70% for file listing and navigation operations. For a team Nextcloud deployment, Redis is effectively mandatory for acceptable performance.
SSL and Security Configuration
HTTPS is required for Nextcloud. Modern browsers and mobile clients refuse to sync files over unencrypted connections. Certbot with Let's Encrypt provides free, auto-renewing certificates.
apt install certbot python3-certbot-nginx -y
certbot --nginx -d cloud.yourdomain.com
Add security headers to your Nextcloud Nginx configuration inside the server block.
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-XSS-Protection "1; mode=block" always;
Backup Strategy for Nextcloud
Nextcloud data consists of three components, all of which must be backed up: the database (contains file metadata, user accounts, sharing permissions), the data directory (actual files uploaded by users), and the Nextcloud configuration directory (/var/www/nextcloud/config/).
Put Nextcloud in maintenance mode before backup to ensure consistency.
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
# Backup database
mysqldump -u nextclouduser -p nextcloud | gzip > /backup/nextcloud-db-$(date +%Y%m%d).sql.gz
# Backup data directory
rsync -avz /var/www/nextcloud/data/ /backup/nextcloud-data/
# Backup config
rsync -avz /var/www/nextcloud/config/ /backup/nextcloud-config/
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
Nextcloud vs Google Drive, Dropbox, and OneDrive
| Feature | Nextcloud (self-hosted) | Google Drive | Dropbox |
|---|---|---|---|
| Monthly cost (1TB) | ~$8-15 VPS | $9.99 (Google One) | $11.99 |
| Data location | Your server | Google's servers | Dropbox's servers |
| GDPR compliance | Full control | Limited | Limited |
| Maximum storage | As large as your VPS disk | 2TB ($9.99 plan) | 2TB ($11.99 plan) |
| Technical requirement | Linux admin skills | None | None |
| File versioning | Yes (configurable) | Yes (30 days) | Yes (180 days) |
| Office document editing | Yes (Collabora/OnlyOffice) | Yes (Google Docs) | Limited |
For most individuals, the cost-per-GB comparison favors Nextcloud only at larger storage volumes (500GB+) where commercial cloud pricing increases significantly. The privacy and control advantages apply at any storage size. For self-hosting in privacy-friendly EU jurisdictions, see our VPS for self-hosting guide, Germany VPS, and Finland VPS for providers with strong privacy laws. Our Nginx setup guide and PostgreSQL VPS guide are useful companions for the full stack setup.