Aisle Files & photos

Nextcloud

Your complete cloud: files, calendar, contacts.

Add to my serverdocker-compose generator (French)Step-by-step guide (French)Compare alternatives (French)Official documentation

What is it for?

Nextcloud is a full suite: file storage and sharing synced across all your devices, calendar, contacts, notes and hundreds of add-ons. It is the most complete open-source alternative to Google Drive.

Who is it for?

People leaving Google Drive or Dropbox who want to share files with family.

Good to know

Major version pinned (35). To move to the next one, change 35 to 36 in both services, one version at a time, after a backup.

After installing

  1. Nextcloud installs itself on first start (2–3 minutes). Log in as admin with the ADMIN_PASSWORD from the .env file, then change it in Personal settings.
  2. Then create one account per person: avoid using the admin account day to day.
  3. Install the Nextcloud app on your phone and computer to sync your files.

The docker-compose

Example behind Traefik. To adapt it (Nginx Proxy Manager, local port…) with a line-by-line explanation, use the generator (in French).

# docker-compose.yml : Nextcloud
services:
  nextcloud:
    image: nextcloud:35-apache
    container_name: nextcloud
    restart: unless-stopped
    depends_on:
      - db
      - redis
    environment:
      POSTGRES_HOST: db
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: "${DB_PASSWORD}"
      REDIS_HOST: redis
      NEXTCLOUD_ADMIN_USER: admin
      NEXTCLOUD_ADMIN_PASSWORD: "${ADMIN_PASSWORD}"
      NEXTCLOUD_TRUSTED_DOMAINS: cloud.mydomain.com
      OVERWRITEPROTOCOL: https
      TRUSTED_PROXIES: "172.16.0.0/12 127.0.0.1"
      TZ: Europe/Paris
    volumes:
      - ./html:/var/www/html
    networks:
      - traefik
      - default
    labels:
      - traefik.enable=true
      - traefik.http.routers.nextcloud.rule=Host(`cloud.mydomain.com`)
      - traefik.http.routers.nextcloud.entrypoints=websecure
      - traefik.http.routers.nextcloud.tls.certresolver=letsencrypt
      - traefik.http.services.nextcloud.loadbalancer.server.port=80
      - traefik.docker.network=traefik
      - traefik.http.routers.nextcloud.middlewares=nextcloud-dav
      - traefik.http.middlewares.nextcloud-dav.redirectregex.regex=^https://([^/]+)/\.well-known/(?:card|cal)dav
      - traefik.http.middlewares.nextcloud-dav.redirectregex.replacement=https://$${1}/remote.php/dav/
      - traefik.http.middlewares.nextcloud-dav.redirectregex.permanent=true

  cron:
    image: nextcloud:35-apache
    container_name: nextcloud-cron
    entrypoint: /cron.sh
    restart: unless-stopped
    depends_on:
      - db
      - redis
    volumes:
      - ./html:/var/www/html

  db:
    image: postgres:17-alpine
    container_name: nextcloud-db
    restart: unless-stopped
    environment:
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: "${DB_PASSWORD}"
    volumes:
      - ./db:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    container_name: nextcloud-redis
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true

networks:
  traefik:
    external: true