Self-Hosted Cloud Storage: Running Nextcloud on Your VPS

Published on

How to set up Nextcloud on a VPS for private cloud storage. Covers installation, configuration, mobile sync, and why self-hosted beats Dropbox and Google Drive.

Written by Jochem, Infrastructure Expert, 5-10 years experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

Why pay for cloud storage that scans your files when you can run your own? Nextcloud gives you Dropbox-like functionality on hardware you control.

Nextcloud self-hosted cloud storage

Nextcloud vs Commercial Cloud

FeatureGoogle DriveDropboxYour Nextcloud
Storage15GB free2GB freeYour VPS storage
PrivacyGoogle reads filesDropbox reads filesNobody reads files
Monthly cost (100GB)$2$12VPS cost
Custom appsNoNoFull app store
File sharingYesYesYes
Calendar/ContactsSeparateNoBuilt-in
Collaborative editingGoogle DocsPaperCollabora/OnlyOffice
End-to-end encryptionNoVault onlyEntire storage

Installation

Prerequisites

sudo apt install apache2 mariadb-server php php-gd php-json php-mysql     php-curl php-mbstring php-intl php-imagick php-xml php-zip     php-apcu php-redis redis-server

Database Setup

sudo mysql -u root
CREATE DATABASE nextcloud;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'your-strong-password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download and Install

cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/latest.tar.bz2
sudo tar -xjf latest.tar.bz2
sudo chown -R www-data:www-data /var/www/nextcloud

Apache Configuration

<VirtualHost *:443>
    ServerName cloud.yourdomain.com
    DocumentRoot /var/www/nextcloud

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/cloud.yourdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/cloud.yourdomain.com/privkey.pem

    <Directory /var/www/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
    </Directory>
</VirtualHost>

SSL with Let's Encrypt

sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d cloud.yourdomain.com

Visit https://cloud.yourdomain.com and complete the web installer.

Performance Optimization

Redis Caching

// /var/www/nextcloud/config/config.php
'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
    'host' => 'localhost',
    'port' => 6379,
],

PHP Optimization

; /etc/php/8.1/apache2/php.ini
memory_limit = 512M
upload_max_filesize = 16G
post_max_size = 16G
max_execution_time = 3600
opcache.enable = 1
opcache.memory_consumption = 128

Sync Clients

PlatformAppAuto-Sync
WindowsNextcloud DesktopYes
macOSNextcloud DesktopYes
LinuxNextcloud DesktopYes
iOSNextcloud iOSYes (including photos)
AndroidNextcloud AndroidYes (including photos)

Mobile clients automatically upload photos to your server, replacing Google Photos.

Storage Requirements

Use CaseRecommended VPS Storage
Documents only25-50GB
Documents + some photos50-100GB
Full photo library200-500GB
Family cloud (2-4 users)200-500GB
Small team (5-10 users)500GB-1TB

NVMe SSD storage from Space-Node's VPS hosting makes Nextcloud feel responsive. File browsing, thumbnail generation, and search all benefit from fast storage.

Useful Nextcloud Apps

AppPurpose
CalendarCalDAV calendar sync
ContactsCardDAV contact sync
NotesMarkdown note-taking
TalkVideo conferencing
Collabora OnlineDocument editing (like Google Docs)
DeckKanban boards
BookmarksBookmark sync across devices

Nextcloud replaces Google Drive, Google Calendar, Google Contacts, Google Keep, and Google Meet - all self-hosted on your own VPS.

Jochem

About the Author

Jochem, Infrastructure Expert, expert in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 5-10 years experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

I specialize in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters.

View my full bio and credentials →

Launch Your VPS Today

Get started with professional VPS hosting powered by enterprise hardware. Instant deployment and 24/7 support included.

Self-Hosted Cloud Storage: Running Nextcloud on Your VPS