Self-Host Nextcloud on a VPS: Your Own Private Cloud Storage

Published on

Complete guide to hosting Nextcloud on a VPS. Covers installation, performance optimization, SSL setup, and mobile sync.

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

Nextcloud gives you Google Drive/Dropbox functionality on hardware you control. Your data stays on your server, in your country, under your rules. Here is how to set it up.

Nextcloud self-hosted cloud storage

Why Self-Hosted Cloud Storage

  • Privacy - No third-party has access to your files
  • Data sovereignty - Your files stay in the datacenter of your choice
  • No storage limits - Limited only by your VPS disk space
  • Full feature set - Calendar, contacts, notes, office docs, video calls
  • No subscription fees - Just your VPS cost

Requirements

  • VPS with at least 2GB RAM (4GB recommended)
  • 50GB+ storage (depends on your needs)
  • A domain name pointed to your VPS

Installation with Docker

The easiest production setup uses Docker Compose:

version: "3.8"

services:
  nextcloud:
    image: nextcloud:stable
    restart: unless-stopped
    volumes:
      - nextcloud_data:/var/www/html
    environment:
      - MYSQL_HOST=db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    depends_on:
      - db
      - redis

  db:
    image: mariadb:10.11
    restart: unless-stopped
    volumes:
      - db_data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}

  redis:
    image: redis:7-alpine
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - /etc/letsencrypt:/etc/letsencrypt:ro
    depends_on:
      - nextcloud

volumes:
  nextcloud_data:
  db_data:

SSL with Let's Encrypt

certbot certonly --standalone -d cloud.yourdomain.com

Configure Nginx to handle SSL termination and proxy to the Nextcloud container.

Performance Tuning

PHP Memory

Increase PHP memory limit in your Nextcloud config:

'memory_limit' => '512M',

Redis Caching

Redis dramatically improves Nextcloud performance. Add to config.php:

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

Background Jobs

Switch from AJAX to cron for background tasks:

# Add crontab entry
*/5 * * * * docker exec -u www-data nextcloud php cron.php

Mobile and Desktop Sync

Nextcloud has official clients for:

  • Desktop: Windows, macOS, Linux - auto-sync folders
  • Mobile: iOS and Android - photo auto-upload, file access
  • WebDAV: Compatible with any WebDAV client

Security

  • Enable server-side encryption for files at rest
  • Use two-factor authentication for all accounts
  • Keep Nextcloud updated (updates are available through the admin panel)
  • Configure your firewall to only allow HTTPS
  • Regular backups of both the database and file storage

Storage Planning

Use CaseRecommended Storage
Documents only50GB
Documents + photos200GB
Full cloud replacement500GB+
Team/family use1TB+

Choose a VPS plan with enough NVMe SSD storage for your needs. Space-Node's VPS plans include NVMe storage starting at 50GB.

Nextcloud is a complete Google Workspace alternative. Once set up, it requires minimal maintenance and gives you full control over your data.

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.