Skip to main content

Self-Host Nextcloud: Google Drive Alternative 2026

·OSSAlt Team
nextcloudgoogle-drivefile-synccollaborationself-hostingdocker2026

TL;DR

Nextcloud (AGPL 3.0, ~27K GitHub stars, PHP) is a complete self-hosted productivity suite — file sync and share, document editing (Collabora/OnlyOffice), calendar and contacts sync (CalDAV/CardDAV), video conferencing (Nextcloud Talk), and 200+ apps. Replace Google Drive ($3/month), Google Docs, Google Calendar, and Google Meet with one self-hosted stack. The All-in-One (AIO) Docker image makes setup significantly easier than the traditional method.

Key Takeaways

  • Nextcloud: AGPL 3.0, ~27K stars, PHP — complete Google Workspace replacement
  • AIO image: Official all-in-one Docker image handles Nextcloud, Postgres, Redis, and reverse proxy
  • Office editing: Collabora Online (LibreOffice) or OnlyOffice for .docx/.xlsx/.pptx in the browser
  • Sync clients: Desktop (Windows/macOS/Linux) and mobile (iOS/Android) — bidirectional sync
  • CalDAV/CardDAV: Sync calendar and contacts with iOS, Android, and Thunderbird
  • Talk: Encrypted video/audio calls without third-party servers (requires TURN server for external access)

Nextcloud vs Google Workspace

FeatureNextcloud (self-hosted)Google Workspace
CostFree (hosting)$6–$18/user/mo
File storageUnlimited (your disk)30GB–5TB/user
Office suiteCollabora / OnlyOfficeGoogle Docs
CalendarYes (CalDAV)Google Calendar
ContactsYes (CardDAV)Google Contacts
Video callsNextcloud TalkGoogle Meet
EmailNo (separate)Gmail
Mobile appsYesYes
Data ownershipYoursGoogle

Part 1: Nextcloud All-in-One (AIO) Setup

The AIO image is the recommended installation method — it manages all components automatically.

# docker-compose.yml
services:
  nextcloud-aio-mastercontainer:
    image: nextcloud/all-in-one:latest
    container_name: nextcloud-aio-mastercontainer
    restart: always
    ports:
      - "8080:8080"    # AIO management interface
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      APACHE_PORT: "11000"          # Port for reverse proxy to forward to
      APACHE_IP_BINDING: "127.0.0.1"
      NEXTCLOUD_DATADIR: "/mnt/ncdata"    # Where files are stored (use external drive)
      NEXTCLOUD_MAX_TIME: "3600"
      NEXTCLOUD_MEMORY_LIMIT: "512M"

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer
docker compose up -d

Visit https://your-server-ip:8080 → AIO management interface.


Part 2: HTTPS with Caddy

AIO requires a reverse proxy that handles TLS. Configure Caddy:

cloud.yourdomain.com {
    reverse_proxy localhost:11000
}

In the AIO management interface:

  1. Enter your domain: cloud.yourdomain.com
  2. Click Submit → AIO validates DNS
  3. Start containers → AIO pulls and starts all services (10–15 minutes first run)
  4. Get your Nextcloud admin password from the AIO interface

Part 3: Traditional Docker Setup (Alternative)

If you prefer manual control:

services:
  db:
    image: postgres:16-alpine
    restart: unless-stopped
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"

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

  nextcloud:
    image: nextcloud:stable-apache
    restart: unless-stopped
    ports:
      - "8080:80"
    volumes:
      - nextcloud_data:/var/www/html
      - /mnt/ncdata:/var/www/html/data    # External storage for files
    depends_on:
      - db
      - redis
    environment:
      POSTGRES_HOST: db
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
      REDIS_HOST: redis
      NEXTCLOUD_ADMIN_USER: admin
      NEXTCLOUD_ADMIN_PASSWORD: "${ADMIN_PASSWORD}"
      NEXTCLOUD_TRUSTED_DOMAINS: "cloud.yourdomain.com"
      OVERWRITEPROTOCOL: "https"
      OVERWRITECLIURL: "https://cloud.yourdomain.com"

volumes:
  db_data:
  nextcloud_data:

Part 4: Desktop Sync Client

  1. Download Nextcloud Desktop (Windows/macOS/Linux)
  2. Add account → Server: https://cloud.yourdomain.com
  3. Log in → Configure sync folders
  4. Files sync automatically in the background

Selective sync: Right-click tray icon → Settings → choose which folders to sync locally.


Part 5: Mobile Apps

Features:

  • Auto-upload photos: Camera roll automatically backed up
  • Offline access: Mark files for offline viewing
  • Talk: Video calls from mobile
  • Files: Browse and edit documents

Part 6: Office Document Editing (Collabora)

Edit .docx, .xlsx, .pptx directly in the browser via Collabora Online:

With AIO

Collabora is included in AIO — enable it in the AIO interface under Optional containers.

Manual Collabora Setup

services:
  collabora:
    image: collabora/code:latest
    container_name: collabora
    restart: unless-stopped
    ports:
      - "9980:9980"
    environment:
      domain: "cloud\\.yourdomain\\.com"    # Escape dots
      username: "admin"
      password: "${COLLABORA_ADMIN_PASSWORD}"
      aliasgroup1: "https://cloud.yourdomain.com:443"
    cap_add:
      - MKNOD
office.yourdomain.com {
    reverse_proxy https://localhost:9980 {
        transport http {
            tls_insecure_skip_verify
        }
    }
}

In Nextcloud → Apps → Install Nextcloud Office → Settings → enter https://office.yourdomain.com.


Part 7: Calendar and Contacts Sync

iOS Setup

Calendar (CalDAV):

  1. Settings → Calendar → Accounts → Add Account → Other → Add CalDAV Account
  2. Server: https://cloud.yourdomain.com/remote.php/dav
  3. Username + password → Save

Contacts (CardDAV):

  1. Settings → Contacts → Accounts → Add Account → Other → Add CardDAV Account
  2. Server: https://cloud.yourdomain.com/remote.php/dav
  3. Username + password → Save

Android (via DAVx5)

  1. Install DAVx5 (open source CalDAV/CardDAV client)
  2. Add account → Login with URL
  3. Base URL: https://cloud.yourdomain.com
  4. Login → Select calendars and address books to sync

Thunderbird

  1. Thunderbird → Calendar → New Calendar → Network
  2. Format: CalDAV
  3. Location: https://cloud.yourdomain.com/remote.php/dav/calendars/username/personal/

Part 8: Nextcloud Talk (Video Calls)

Nextcloud Talk provides end-to-end encrypted video and audio calls:

  1. Apps → Install Nextcloud Talk
  2. For internal calls (LAN): works immediately
  3. For external access: requires a TURN server

TURN Server for External Video Calls

services:
  coturn:
    image: coturn/coturn:latest
    restart: unless-stopped
    network_mode: host
    command: >
      -n --log-file=stdout
      --min-port=49160 --max-port=49200
      --realm=cloud.yourdomain.com
      --static-auth-secret="${TURN_SECRET}"

In Nextcloud → Settings → Talk → TURN server:

  • URL: turn:turn.yourdomain.com:3478
  • Secret: your TURN_SECRET

Part 9: External Storage

Mount S3, SFTP, or other cloud storage as a Nextcloud folder:

  1. Apps → Install External Storage Support
  2. Settings → External Storages → Add Storage
  3. Type: Amazon S3
    • Bucket: my-nextcloud-bucket
    • Region: us-east-1
    • Key + Secret
  4. Folder appears in your Nextcloud Files

Performance Tuning

# /var/www/html/config/config.php additions:

'memcache.local' => '\OC\Memcache\APCu',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => [
    'host' => 'redis',
    'port' => 6379,
],
'default_phone_region' => 'US',
'maintenance_window_start' => 1,    # Run maintenance at 1am UTC

Maintenance

# Update (AIO):
# AIO management interface → Update

# Update (manual):
docker compose pull
docker compose up -d

# Run occ commands (Nextcloud CLI):
docker exec --user www-data nextcloud php occ status
docker exec --user www-data nextcloud php occ upgrade
docker exec --user www-data nextcloud php occ files:scan --all

# Backup:
docker exec --user www-data nextcloud php occ maintenance:mode --on
tar -czf nextcloud-backup-$(date +%Y%m%d).tar.gz /mnt/ncdata
# Backup database:
docker exec db pg_dump -U nextcloud nextcloud > nextcloud-db-$(date +%Y%m%d).sql
docker exec --user www-data nextcloud php occ maintenance:mode --off

See all open source collaboration and file sync tools at OSSAlt.com/alternatives/google-drive.

Comments