Skip to main content
WebsiteGitHub last commitGitHub commit activityGitHub IssuesDocker PullsDiscordLocalized

Self-Hosted Cloud Storage: Complete Nextcloud Setup Guide

· 3 min read
BankaiTech
Homelab Enthusiast & Self-Hosting Advocate

Tired of paying for Google Drive or Dropbox? Want full control over your data? Nextcloud is the answer. This post covers everything you need to know about deploying your own cloud storage platform.

What is Nextcloud?

Nextcloud is a self-hosted productivity platform that provides:

  • File storage and sync - Like Dropbox, but yours
  • Calendar and contacts - Replace Google Calendar
  • Collaborative editing - With Collabora or OnlyOffice
  • Photo management - With the Memories app
  • Video calls - Built-in Talk functionality
  • And much more - Through a vast app ecosystem

Choosing Your Installation Method

We support multiple installation approaches:

MethodBest ForComplexity
Docker (Complete)Full features, easy updatesMedium
Docker (Minimum)Quick start, basic featuresLow
SnapRaspberry Pi, simplicityLow
ManualMaximum controlHigh

For most homelabbers, Docker (Complete) is the sweet spot.

The Complete Docker Stack

Our recommended setup includes:

  • Nextcloud - The main application
  • MariaDB - Database backend
  • Redis - Caching for performance
  • Collabora - Document editing
  • Cron - Background job processing

Here's a simplified version of the compose file:

docker-compose.yml
services:
nextcloud:
image: nextcloud:production
container_name: nextcloud
restart: unless-stopped
depends_on:
- mariadb
- redis
ports:
- "8080:80"
environment:
- MYSQL_HOST=mariadb
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=${DB_PASSWORD}
- REDIS_HOST=redis
volumes:
- nextcloud_data:/var/www/html

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

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

volumes:
nextcloud_data:
mariadb_data:

Performance Optimization

Enable Redis Caching

Add to your Nextcloud config.php:

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

Background Jobs

Ensure cron is running properly:

docker exec -u www-data nextcloud php cron.php

Or use our dedicated cron container in the full stack.

Photo Management with Memories

The Memories app transforms Nextcloud into a Google Photos alternative:

  1. Install Memories from the app store
  2. Install go-vod for video transcoding
  3. Configure the preview generator
  4. Run initial indexing
docker exec -u www-data nextcloud php occ memories:index

Backup Strategy

Critical: Always back up both your files AND your database!

# Database backup
docker exec nextcloud-db mysqldump -u root -p${DB_ROOT_PASSWORD} nextcloud > backup.sql

# Volume backup
docker run --rm -v nextcloud_data:/data -v $(pwd):/backup alpine \
tar czf /backup/nextcloud-files.tar.gz /data

Check out our comprehensive backup guide for automated solutions.

Common Issues and Solutions

"Maintenance mode" loops

docker exec -u www-data nextcloud php occ maintenance:mode --off

Slow initial page loads

Enable APCu and Redis caching, run cron consistently.

Upload size limits

Configure PHP limits in your environment:

environment:
- PHP_UPLOAD_LIMIT=16G

Learn More

For complete, production-ready configurations:


Self-hosting your data is a journey. Join us on Discord to share your experiences!