Nextcloud Hub: Self-Hosted Google Workspace Alternative
Nextcloud started as a file sync tool (like Dropbox) and has grown into a full collaboration platform. Nextcloud Hub adds Calendar, Contacts, Talk (video/messaging), Office (document editing), and Mail to the core file sync. The result is a credible Google Workspace alternative that runs on your infrastructure.
Photo by BoliviaInteligente on Unsplash
What Nextcloud Hub Includes
Files: File sync and share. Desktop sync clients (Windows, Mac, Linux), mobile apps, web interface. Versioning, trash, sharing with links or user accounts.
Calendar: CalDAV-compatible calendar. Sync with iOS Calendar, Android, macOS, Thunderbird. Create, share, and subscribe to calendars.
Contacts: CardDAV contact storage. Sync with phone contacts, macOS Contacts, Thunderbird.
Talk: Video/audio calls, chat, and group messaging. Screen sharing. No external infrastructure needed — runs on your server.
Collabora Online / Nextcloud Office: Real-time collaborative document editing (Writer, Calc, Impress). Either self-hosted Collabora or the lighter-weight Nextcloud Office.
Mail: Webmail client connecting to your existing IMAP accounts.
Deck: Kanban boards for project management.
Photos: Photo viewing with albums and memories timeline.
Docker Compose Deployment
Nextcloud with PostgreSQL and Redis:
services:
nextcloud:
image: nextcloud:28-apache
restart: always
ports:
- 8080:80
volumes:
- nextcloud-data:/var/www/html
- /path/to/your/data:/var/www/html/data # External data directory
environment:
POSTGRES_HOST: nextcloud-db
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: change-this
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: change-admin-password
NEXTCLOUD_TRUSTED_DOMAINS: nextcloud.yourdomain.com
REDIS_HOST: nextcloud-redis
PHP_MEMORY_LIMIT: 512M
PHP_UPLOAD_LIMIT: 512M
depends_on:
- nextcloud-db
- nextcloud-redis
nextcloud-db:
image: postgres:15-alpine
restart: always
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: change-this
volumes:
- nextcloud-db:/var/lib/postgresql/data
nextcloud-redis:
image: redis:7-alpine
restart: always
# Cron job for background tasks
nextcloud-cron:
image: nextcloud:28-apache
restart: always
volumes:
- nextcloud-data:/var/www/html
entrypoint: /cron.sh
depends_on:
- nextcloud-db
- nextcloud-redis
volumes:
nextcloud-data:
nextcloud-db:
Note: Put your actual data on an external path (not a named volume) if you have a large storage volume mounted. The /var/www/html volume is for app code; /var/www/html/data is user files.
Initial Setup
After starting, navigate to your URL and Nextcloud will complete the admin setup (unless you set NEXTCLOUD_ADMIN_USER in environment variables, in which case it's already done).
Post-install tasks:
- Set up a reverse proxy with HTTPS (required for mobile sync)
- Configure email for notifications: Settings → Basic settings → Email server
- Set up cron: ensure the cron container is running (replaces Nextcloud's webcron)
- Configure Redis memcache (should be automatic from the compose above)
Like what you're reading? Subscribe to Self-Hosted Weekly — free weekly guides in your inbox.
Performance: The Critical Tweaks
Nextcloud can be slow without tuning. Key changes:
APCu for local cache (add to nextcloud container environment):
environment:
PHP_OPCACHE_ENABLE: 1
PHP-FPM instead of Apache mod_php: The nextcloud:fpm image uses PHP-FPM with Nginx, which is faster:
image: nextcloud:28-fpm
This requires a separate Nginx container configured as a frontend.
Redis for file locking (already in compose above — ensure REDIS_HOST is set).
Nextcloud config.php optimizations:
docker exec -u www-data nextcloud php occ config:system:set memcache.local --value='\OC\Memcache\APCu'
docker exec -u www-data nextcloud php occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
docker exec -u www-data nextcloud php occ config:system:set maintenance_window_start --value=1
Default phone region (fixes warnings):
docker exec -u www-data nextcloud php occ config:system:set default_phone_region --value='US'
occ Command Line Interface
Nextcloud's CLI (occ) is essential for administration:
# Run as www-data user in the container
docker exec -u www-data nextcloud php occ <command>
# Common commands:
docker exec -u www-data nextcloud php occ status
docker exec -u www-data nextcloud php occ upgrade
docker exec -u www-data nextcloud php occ files:scan --all # Re-scan for file changes
docker exec -u www-data nextcloud php occ user:list
docker exec -u www-data nextcloud php occ app:list # Installed apps
docker exec -u www-data nextcloud php occ maintenance:mode --on # Enable maintenance mode
Mobile Clients
File sync: Nextcloud iOS and Android apps. Set up server URL (your HTTPS domain), log in, enable auto-upload for photos.
Calendar: iOS — Settings → Calendar → Accounts → Add Account → Other → CalDAV. URL: https://nextcloud.yourdomain.com/remote.php/dav/
Contacts: iOS — Settings → Contacts → Accounts → Add Account → Other → CardDAV. Same URL format.
The CalDAV/CardDAV auto-discovery works if your server is accessible via HTTPS.
Nextcloud Office (Collaborative Editing)
For collaborative document editing without a full Collabora installation:
- Install the "Nextcloud Office" app (lighter weight, built-in)
- Or install "Collabora Online" app and connect a Collabora instance
Nextcloud Office is simpler — it's bundled and requires no separate service. Collabora Online has better compatibility with complex documents.
Key Apps Worth Installing
From the App Store (Settings → Apps):
- Calendar: Calendar app (usually pre-installed)
- Contacts: Contacts app
- Deck: Kanban boards
- Tasks: Tasks/to-do lists syncing with CalDAV
- Notes: Simple markdown notes
- Photos: Enhanced photo browsing
- Talk: Video/chat (requires TURN server for reliable external connections)
- External storage: Mount S3, FTP, SMB shares in Nextcloud
Backups
# 1. Enable maintenance mode
docker exec -u www-data nextcloud php occ maintenance:mode --on
# 2. Backup database
docker exec nextcloud-db pg_dump -U nextcloud nextcloud > nextcloud_$(date +%Y%m%d).sql
# 3. Backup data directory
rsync -av /path/to/your/data/ backup/
# 4. Backup config
docker exec nextcloud cat /var/www/html/config/config.php > nextcloud_config.php
# 5. Disable maintenance mode
docker exec -u www-data nextcloud php occ maintenance:mode --off
Hardware Requirements
| Users | RAM | CPU |
|---|---|---|
| 1-5 | 2GB | 2 cores |
| 5-20 | 4GB | 4 cores |
| 20+ | 8GB+ | 4+ cores |
Nextcloud is PHP-based and memory-hungry. File transfers and photo thumbnailing are CPU-intensive. On a $20/month VPS (2vCPU, 4GB RAM), Nextcloud runs smoothly for a family of 5.
