Nextcloud: Your Self-Hosted Google Workspace Replacement
Every time you open Google Drive, Google’s crawlers have already read what’s in it. Every calendar event feeds a behavioral profile. Every document you collaborate on in Google Docs is processed, indexed, and used to serve ads and train models. You agreed to this in the Terms of Service — you just probably didn’t think about it much.
For individual users the price is your data. For teams the price is also money: Google Workspace Business Starter is $6/user/month, Business Standard is $12/user/month, and it scales from there. A ten-person team on Business Standard is $1,440/year for a suite you don’t control, running on hardware you’ve never seen, in a jurisdiction that may not be your own.
Nextcloud is the answer to both problems. It’s a mature, open-source, self-hosted collaboration platform that replaces Drive, Calendar, Contacts, Google Photos, Docs, Sheets, Slides, and Meet — running on your hardware, under your control, with zero licensing fees. This guide walks through the full deployment: Docker Compose stack with Traefik and Collabora, performance tuning, CalDAV/CardDAV sync, office editing, security hardening, backup, and migrating your data out of Google.
Part 1: Why Leave Google Workspace?
The Privacy Argument
Google’s core business is advertising. Everything Google builds serves the purpose of knowing more about you so it can sell more targeted ads. The G Suite / Workspace product suite is not an exception to this.
Under Google’s Terms of Service, Google retains broad rights to process content stored in Drive and Gmail for the purpose of “improving services.” This includes scanning file contents, analyzing communication patterns, and building behavioral profiles. Google Photos runs facial recognition on every uploaded photo. Calendar events feed “smart” features that happen to require full read access to your schedule.
For personal use this may feel abstract. For businesses handling client data, medical records, financial information, or any regulated data category, it’s a concrete compliance risk. HIPAA, GDPR, SOC2, and sector-specific frameworks all have something to say about storing sensitive data with a third party whose primary incentive is to monetize it.
The Cost Argument
At the individual level, Google Workspace pricing seems reasonable. At team scale it compounds fast:
| Plan | Per User/Month | 10 Users/Year | 50 Users/Year |
|---|---|---|---|
| Business Starter | $6 | $720 | $3,600 |
| Business Standard | $12 | $1,440 | $7,200 |
| Business Plus | $18 | $2,160 | $10,800 |
A self-hosted Nextcloud stack on a $50/month VPS or on hardware you already own eliminates these recurring fees entirely. The break-even against a dedicated server is often under 12 months.
Data Sovereignty
When your data lives on Google’s infrastructure, it lives in Google’s jurisdiction, under Google’s legal obligations. Law enforcement requests, subpoenas, and data access demands go to Google — not to you. Google may comply with requests you’re never informed about.
Self-hosting puts your data under your physical and legal control. You choose the jurisdiction. You decide who has access. You receive and respond to any legal requests yourself.
The Vendor Lock-In Problem
Google kills products. Not occasionally — systematically. Google Reader, Google+, Inbox, Stadia, Google Play Music, Google Hangouts, Google Podcasts, and dozens more. Every time Google shutters a product, users scramble to export their data and find alternatives, often losing years of accumulated content in the process.
Nextcloud is open source. The code isn’t going anywhere. The formats it uses — CalDAV, CardDAV, WebDAV, open document formats — are open standards. Even if Nextcloud GmbH ceased to exist tomorrow, every existing instance would continue running, and the community would carry the project forward.
The Replacement Map
| Google Service | Nextcloud Equivalent |
|---|---|
| Google Drive | Nextcloud Files |
| Google Photos | Nextcloud Photos + Face Recognition app |
| Google Calendar | Nextcloud Calendar (CalDAV) |
| Google Contacts | Nextcloud Contacts (CardDAV) |
| Google Docs/Sheets/Slides | Collabora Online or OnlyOffice |
| Google Meet | Nextcloud Talk |
| Google Tasks | Nextcloud Tasks (CalDAV VTODO) |
| Google Notes (Keep) | Nextcloud Notes |
What Nextcloud does not replace directly: Gmail (use it alongside an external mail server like Stalwart or Postfix/Dovecot, or with a provider like Fastmail/Proton), and Google Maps (OpenStreetMap-based apps like OsmAnd fill this on mobile).
Part 2: Nextcloud Architecture and Editions
Nextcloud Hub
The current release is Nextcloud Hub, which bundles the core platform with four integrated pillars:
- Files — file sync, sharing, versioning, external storage
- Talk — chat, video calls, and screen sharing
- Groupware — Calendar, Contacts, Mail client (IMAP front-end)
- Office — Collabora/OnlyOffice integration for document editing
The Hub branding signals that Nextcloud is no longer just a file sync tool — it’s a full collaboration platform.
Nextcloud vs ownCloud
Nextcloud and ownCloud share a common history. Frank Karlitschek founded ownCloud in 2010. In 2016, tensions over the project’s direction led him to fork it as Nextcloud. The fork took most of the active developer community with it.
Today, Nextcloud is unambiguously the more active project: more frequent releases, a vastly larger app ecosystem, more community involvement, and more transparent development. ownCloud still exists as a commercial-focused fork, but for self-hosting purposes Nextcloud is the clear choice.
Deployment Options
- Self-hosted (this guide): Full control, no licensing cost, you handle maintenance
- Nextcloud.com managed hosting: Nextcloud GmbH offers hosted instances starting around €15/month — useful if you want Nextcloud features without the ops burden
- Snap/AIO packages: The Nextcloud All-in-One Docker image bundles everything in a single container with a management interface — good for beginners, less flexible for advanced configs
Core Architecture
┌─────────────────────────────────────────┐
│ Traefik (HTTPS) │
└────────────────┬────────────────────────┘
│
┌───────────┴──────────┐
│ │
┌────▼──────┐ ┌────────▼──────┐
│ Nextcloud │ │ Collabora │
│ (PHP) │ │ Online │
└────┬──────┘ └───────────────┘
│
├──── PostgreSQL (persistent data)
├──── Redis (sessions, file locking, cache)
└──── Data Volume / NAS Mount (files)
Nextcloud is a PHP application. It supports SQLite (dev only), MySQL/MariaDB, and PostgreSQL as database backends. PostgreSQL is strongly recommended for any multi-user deployment — it handles concurrent writes better than MySQL and has superior full-text search support for Nextcloud’s file indexing.
Redis serves two critical roles: distributed session locking (prevents file corruption when multiple clients write simultaneously) and a fast key-value cache that dramatically reduces database load.
The app ecosystem is a key differentiator. The Nextcloud App Store lists 300+ apps: antivirus scanning with ClamAV, full-text search, LDAP/AD integration, mail client, password manager (Passman/Passwords), Kanban boards (Deck), wiki, Bookmarks, Forms, Polls, and much more.
Part 3: Full Docker Compose Deployment
This stack includes Nextcloud, PostgreSQL, Redis, Collabora Online, and Traefik with automatic Let’s Encrypt certificates.
Directory Structure
/opt/nextcloud/
├── docker-compose.yml
├── .env
├── traefik/
│ ├── traefik.yml
│ └── acme.json # chmod 600
└── data/ # or mount NAS here
Environment File
|
|
Complete docker-compose.yml
|
|
Traefik Configuration
|
|
|
|
Post-Install occ Commands
The occ command is Nextcloud’s CLI administration tool. Run it as the www-data user inside the container:
|
|
Part 4: Initial Configuration
The config.php File
Nextcloud’s main configuration lives at /var/www/html/config/config.php inside the container. You can edit it directly or use occ config:system:set. Here’s a complete production-ready config section:
|
|
Background Jobs (Cron)
Nextcloud performs background tasks: generating previews, sending notifications, cleaning up trash, syncing federated shares. These need to run reliably. The default “Ajax” method runs jobs only when someone opens the web UI. Cron is far more reliable.
The nextcloud_cron service in the compose file handles this automatically via the built-in /cron.sh script, which runs occ cron:cron every 5 minutes.
Verify it’s working:
|
|
Email Notifications
Configure SMTP so Nextcloud can send share notifications, password resets, and security alerts:
|
|
Maintenance Mode
|
|
Part 5: Performance Tuning
A default Nextcloud installation will feel sluggish with multiple users. These optimizations make a substantial difference.
Redis Caching
Redis serves as both a distributed cache and a file locking backend. File locking is critical in multi-user environments — without it, simultaneous edits or uploads can corrupt files. The config.php settings shown above configure all three cache layers:
memcache.local→ APCu (in-process PHP memory cache, fastest for single-process reads)memcache.distributed→ Redis (shared across PHP workers, used for session data)memcache.locking→ Redis (transactional file locks)
Verify Redis is being used:
|
|
APCu Configuration
APCu is an in-memory cache for PHP. Ensure it’s configured with adequate memory in your PHP config:
|
|
For the Apache-based image, you can add this via a custom Docker build or by exec-ing into the container and adding the file.
PHP-FPM Tuning
For the nextcloud:fpm-alpine image variant, tune the pool configuration:
|
|
The right pm.max_children depends on your RAM. A conservative estimate: each PHP-FPM worker uses roughly 50-100MB. On a 4GB server with other services running, 20 children is a reasonable ceiling.
OPcache
OPcache compiles PHP scripts to bytecode and caches them in memory, eliminating repeated parsing overhead:
|
|
Database Optimization
|
|
Preview Generation
Nextcloud generates thumbnails for images, PDFs, and videos. This is I/O intensive and can slow down the file browser if done on-demand. The Preview Generator app processes previews in bulk as a background job:
|
|
Enable the preview providers you need in config.php:
|
|
Rescanning External Storage
|
|
Part 6: Nextcloud Files
Web Interface
The Files app is Nextcloud’s core. The web UI provides folder navigation, drag-and-drop upload, right-click context menus for sharing and versioning, integrated search, and tag-based filtering. The Activities sidebar shows a per-file audit trail: who accessed, edited, or shared a file and when.
Desktop Sync Clients
Download from nextcloud.com/install:
- Windows: Installer with system tray icon and selective sync
- macOS: Native app with Finder integration, virtual files (on-demand sync)
- Linux: AppImage, Flatpak, or distro packages; also virtual file support
Configuration: enter your server URL (https://cloud.example.com), authenticate, choose folders to sync. The client handles conflict resolution automatically — conflicted copies are named filename (conflicted copy YYYY-MM-DD).ext.
Mobile Apps
- iOS: Nextcloud app on the App Store — Files integration, auto-upload for Camera Roll
- Android: Nextcloud app on Google Play or F-Droid — same features plus optional auto-upload
External Storage
Mount external systems as if they were local Nextcloud folders. Enable the External Storage Support app, then configure mounts in Settings → Administration → External Storages:
| Backend | Auth Method | Notes |
|---|---|---|
| Local path | None | Mount a directory on the host |
| NFS | None (host-level) | Mount NFS share on the Docker host |
| SMB/CIFS | Username/password | Mount Windows shares |
| S3/S3-compatible | Access key | MinIO, Wasabi, Backblaze B2 |
| SFTP | Username/key | Any SFTP server |
| WebDAV | Username/password | Another Nextcloud, OwnCloud |
Versioning and Trash Bin
Nextcloud stores previous versions of files automatically. The retention policy uses exponential backoff:
- All versions from the last second
- One version per second for the first 10 seconds
- One version per minute for the first 10 minutes
- One version per hour for the first 24 hours
- One version per day for the first month
- One version per week after that
Deleted files go to the trash bin, where they’re retained for 30 days by default. Both can be configured:
|
|
Encryption
Server-Side Encryption (SSE): Files are encrypted at rest on the server. The encryption key is derived from the user’s Nextcloud password. This protects against someone stealing the raw disk, but not against a compromised Nextcloud admin account — the server holds the keys.
|
|
End-to-End Encryption (E2EE): Keys are generated and held on the client. The server never sees plaintext. More secure, but significantly more operationally complex — recovery is difficult if keys are lost, and some features (admin access, server-side search) don’t work with E2EE folders. Enable via the E2E Encryption app and the desktop client.
For most homelab use cases, SSE is the practical choice. The bigger security gain comes from strong access controls, 2FA, and not exposing the server to the internet without proper hardening.
Sharing
- Internal shares: Share files/folders with other Nextcloud users or groups. Set read-only, can edit, or can share permissions.
- Public links: Generate a shareable URL with optional password protection and expiry date. Enable downloads only, or allow uploads (public dropbox-style folder).
- Federated sharing: Share files with users on other Nextcloud instances using the format
user@other-cloud.example.com. Enables a decentralized, cross-organization collaboration network.
Large File Uploads
Nextcloud uses chunked upload for large files. Configure the maximum chunk and total size:
|
|
In Apache’s nextcloud config (/etc/apache2/sites-available/nextcloud.conf):
|
|
The PHP_UPLOAD_LIMIT=10G environment variable in the compose file sets upload_max_filesize and post_max_size for PHP.
Part 7: Groupware — Calendar and Contacts
Nextcloud Calendar (CalDAV)
Install the Calendar app from the Nextcloud App Store (or via ncc app:install calendar). Each user gets a personal calendar by default. Calendars can be shared with specific users, groups, or as public read-only links.
Calendar URL format:
https://cloud.example.com/remote.php/dav/calendars/USERNAME/CALENDAR-NAME/
Syncing Calendars
macOS:
- System Settings → Internet Accounts → Add Account → CalDAV (manual)
- Account type: Advanced
- User name: your Nextcloud username
- Password: your Nextcloud password (or app password)
- Server address:
cloud.example.com - Server path:
/remote.php/dav/principals/users/USERNAME/ - Port: 443, SSL: checked
iOS:
- Settings → Calendar → Accounts → Add Account → Other
- Add CalDAV Account
- Server:
cloud.example.com - User name and password as above
Android — DAVx5 (recommended, available on F-Droid and Play Store):
- Add account → URL and user name
- Base URL:
https://cloud.example.com/remote.php/dav/ - Enter credentials
- DAVx5 discovers all calendars and address books automatically
- Select which to sync, set sync interval
Thunderbird: Thunderbird 102+ has built-in CalDAV support. Calendar → New Calendar → On the Network → CalDAV. Enter the calendar URL directly.
Import/Export
|
|
The Birthday Calendar app automatically creates a calendar that pulls birthdays from your Contacts app — a nice replacement for the feature Google Calendar provides.
Nextcloud Contacts (CardDAV)
Install the Contacts app. Address books work the same as calendars — each user gets a default address book, shareable with other users.
CardDAV URL format:
https://cloud.example.com/remote.php/dav/addressbooks/users/USERNAME/ADDRESSBOOK-NAME/
Syncing Contacts
macOS: System Settings → Internet Accounts → Add Account → CardDAV. Use the same server details as CalDAV above. macOS will auto-discover address books.
iOS: Settings → Contacts → Accounts → Add Account → Other → Add CardDAV Account. Server: cloud.example.com, username and password.
Android — DAVx5: Same setup as Calendar sync — DAVx5 handles both CalDAV and CardDAV from a single account configuration.
Thunderbird: Tools → Add-ons → search “CardBook” — a well-maintained CardDAV extension for Thunderbird.
Migrating from Google Contacts
- Google Contacts → Export → select “Google CSV” or “vCard (for iOS Contacts)”
- In Nextcloud Contacts app → Import → select the
.vcffile
For large contact lists:
|
|
Nextcloud Tasks
The Tasks app syncs via the CalDAV VTODO standard. Install it, and your tasks appear in Thunderbird, iOS Reminders (with CalDAV sync), and Android apps like OpenTasks or Tasks.org. Tasks created in the Calendar view with a date show up alongside events.
Part 8: Nextcloud Office — Document Editing
What is Collabora Online?
Collabora Online is a server-side document editing solution built on LibreOffice. It runs in a Docker container and renders documents in the browser using a web socket connection. Nextcloud integrates with it through the Nextcloud Office app (formerly called Richdocuments).
From the user’s perspective: click a .docx, .xlsx, or .pptx file in Nextcloud and it opens in a rich browser editor without leaving the Nextcloud interface. Multiple users can edit simultaneously and see each other’s cursors in real time.
CODE (Collabora Online Development Edition) is the free, community version. It has some resource and connection limits but is fully functional for homelab and small team use.
Connecting Nextcloud to Collabora
|
|
In the Nextcloud web UI: Settings → Administration → Nextcloud Office → enter the Collabora URL.
Collabora Configuration
The aliasgroup1 environment variable in the compose file tells Collabora which domains are allowed to send documents to it. The value is a regex:
|
|
OnlyOffice as an Alternative
OnlyOffice Document Server is an alternative to Collabora with notably better Microsoft Office format compatibility — particularly for complex Word documents with tracked changes, and Excel files with advanced formulas. The trade-offs:
| Collabora Online (CODE) | OnlyOffice | |
|---|---|---|
| Base | LibreOffice | Proprietary engine |
| MS Office compat | Good | Excellent |
| Free tier | Full features, some limits | 20 connections free |
| Resource usage | Lower | Higher (~2GB RAM minimum) |
| Native format | ODF | OOXML |
| Collaborative editing | Yes | Yes |
| Best for | Pure OSS, privacy-first | MS Office-heavy workflows |
To use OnlyOffice instead:
|
|
Then install the ONLYOFFICE app in Nextcloud instead of Richdocuments.
For homelab use where the team is primarily using Nextcloud’s native ODF formats or needs a fully open-source stack, Collabora is the better fit. If your team lives in .docx files from Microsoft 365 collaborators, OnlyOffice’s compatibility edge is worth the extra RAM.
Part 9: Nextcloud Talk
What it Replaces
Nextcloud Talk is a self-hosted chat and video conferencing platform. It replaces Google Meet for video calls, and partially replaces Slack/Teams for team chat — with the significant advantage of being fully integrated into your Nextcloud file sharing and calendar ecosystem.
Features: 1:1 and group text chat, file sharing in chat, 1:1 and group video calls, screen sharing, call recordings (with the Recording Backend), and message reactions.
The TURN Server Problem
WebRTC (the technology behind browser video calls) requires peers to exchange IP addresses to establish direct connections. Behind NAT — which is almost every homelab — this direct exchange often fails. A TURN server acts as a relay when direct peer-to-peer fails.
Without a TURN server, Talk calls will fail for users behind strict NAT. This is the most common Talk misconfiguration.
coturn is the standard open-source TURN server:
|
|
Configure Talk to use the TURN server:
|
|
Or in the Nextcloud web UI: Settings → Administration → Talk → STUN servers and TURN servers.
Open firewall ports: TCP/UDP 3478, TCP/UDP 5349, and UDP 49160-49200.
Mobile Apps
Nextcloud Talk apps for iOS and Android handle push notifications for incoming calls and messages — a key practical requirement for a Google Meet replacement. Install from the App Store / Google Play / F-Droid.
High-Performance Backend (optional)
For organizations with more than ~10 simultaneous call participants, the default Talk server struggles with signaling. The Spreed High Performance Backend (HPB) offloads signaling to a dedicated Go service. This is optional for homelab use and adds significant deployment complexity — skip it unless you’re running large recurring meetings.
Part 10: Security Hardening
HTTPS is Non-Negotiable
Never run Nextcloud over plain HTTP. The Traefik configuration above handles this. Additionally, Nextcloud will refuse to work correctly without HTTPS — it sets secure cookies and will warn loudly in the admin panel if HTTPS is not detected.
Two-Factor Authentication
Enable 2FA for admin and all user accounts:
|
|
For hardware security keys (YubiKey, Passkey):
|
|
App Passwords for Clients
Require app-specific passwords for sync clients, DAVx5, and the desktop app. This means a compromised client password doesn’t expose your main account and enables you to revoke individual client access. Users create app passwords under Settings → Security → Devices & sessions.
Brute Force Protection
Nextcloud includes built-in brute force protection that throttles login attempts from an IP after repeated failures. This is enabled by default. If you lock yourself out:
|
|
Fail2ban Integration
For additional protection, fail2ban can monitor Nextcloud’s log file and block IPs at the firewall level:
|
|
|
|
Security Scan
Run the official security scan at scan.nextcloud.com after setup. It checks your Nextcloud version, known CVEs, HSTS configuration, and a set of common misconfigurations.
Disabling User Enumeration
By default, Nextcloud’s login page reveals whether a username exists through error messages. Disable this:
|
|
Limiting Public Access
|
|
Keeping Nextcloud Updated
|
|
Part 11: Backup Strategy
What to Back Up
A complete Nextcloud backup requires three components:
- Data directory — all user files (
/var/www/html/datavolume) - Database dump — all metadata, shares, calendar entries, contacts
- config.php — your system configuration
The nextcloud_html volume (the application code) does not need to be backed up if you’re using a named Docker image — you can recreate it from the image.
Complete Backup Script
|
|
For remote backup, use Restic for encrypted, deduplicated backup to any S3-compatible backend:
|
|
Restore Procedure
|
|
Part 12: Migrating from Google
Step 1: Export Your Google Data
Start with Google Takeout (takeout.google.com):
- Select: Drive, Photos, Calendar, Contacts
- Format: choose
.zipfor files,.icsfor Calendar,.vcffor Contacts - Request the export — Google will email you when it’s ready (can take hours for large accounts)
Step 2: Import Google Drive Files
For large Drive archives, rclone is far more reliable than a manual upload:
|
|
After the rclone sync completes, rescan so Nextcloud indexes the new files:
|
|
Step 3: Import Google Calendar
From your Google Takeout zip, find the .ics files (one per calendar):
- Open Nextcloud Calendar
- Click the three-dot menu next to the calendar name → Import
- Select the
.icsfile
For the command line (via rclone and the CalDAV API):
|
|
Step 4: Import Google Contacts
From Takeout or directly from contacts.google.com → Export:
- Export as vCard (.vcf)
- In Nextcloud Contacts → Import → select the
.vcffile
Google Contacts exports a single large .vcf file containing all contacts. Nextcloud handles this in one import.
Step 5: Google Photos Migration
Google Photos export via Takeout includes photos in their original resolution but the metadata (album membership, descriptions, some EXIF) is in sidecar JSON files rather than embedded in the images. The tool gphotos-exiftool or exiftool can merge the metadata back:
|
|
Then upload via rclone or the desktop sync client:
|
|
Enable the Nextcloud Photos app and the Face Recognition app (requires PHP extension and some CPU time for initial scan) for an experience similar to Google Photos.
Step 6: Update Your Workflow
- Install the Nextcloud desktop sync client and point it at
~/Nextcloudinstead of Google Drive - Replace Google Calendar with the Nextcloud Calendar app + DAVx5 (Android) or native sync (iOS/macOS)
- Replace Google Contacts with the Nextcloud Contacts app via the same sync tools
- Set
.docx/.xlsxfile associations to open in the browser via Nextcloud, or use LibreOffice locally - Configure mobile auto-upload in the Nextcloud iOS/Android app to replace Google Photos auto-backup
Closing Thoughts
Nextcloud is not a weekend project — a production deployment with Collabora, Talk, and proper backups is a real infrastructure commitment. You’re taking on the maintenance that Google would otherwise handle: applying security updates, monitoring disk usage, managing database growth, and testing restores.
But the payoff is substantial. Your data stays on hardware you own, in the jurisdiction you choose, under policies you set. You can audit every configuration. You’re not funding an advertising company with your private communications. And you’re not at the mercy of a product manager deciding to sunset a service you depend on.
The stack in this guide handles a dozen users on a reasonably modest server. With proper Redis caching and PostgreSQL tuning it scales further. The open standards it uses — CalDAV, CardDAV, WebDAV, OpenDocument Format — mean your data is never locked in a proprietary format.
Start with the basics: get Files and the desktop client working. Add Calendar and Contacts via DAVx5. Then add Collabora when you’re ready to drop Google Docs. Each component you migrate reduces your dependence on cloud services you don’t control.
The tools are ready. The question is whether the operational overhead is worth it to you — and for privacy-conscious users who’ve thought seriously about what Google is doing with their data, it almost always is.
Comments