> For AI agents: the complete documentation index is available at https://www.tteam.icu/llms.txt, the full documentation bundle is available at https://www.tteam.icu/llms-full.txt.

# nextcloud网盘

Nextcloud 是功能完整的私有网盘和协作平台，适合文件同步、共享、日历、联系人和插件扩展等场景。

小规模个人测试可以使用 SQLite；如果要长期使用或多人访问，建议使用 PostgreSQL 作为数据库。

## 使用 SQLite

```yaml
version: "2.1"
services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Shanghai
    volumes:
      - ./nextcloud/config:/config
      - ./nextcloud/data:/data
    ports:
      - 8087:80
    restart: unless-stopped

```

## 使用 PostgreSQL 作为数据库

```yaml
version: '3'

services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: nextcloud
    volumes:
      - ./db:/var/lib/postgresql/data

  app:
    image: nextcloud
    restart: always
    ports:
      - "8087:80"
    volumes:
      - ./nextcloud:/var/www/html
    depends_on:
      - db
    environment:
      - POSTGRES_HOST=db
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
      - POSTGRES_PASSWORD=nextcloud

```

:::tip
生产使用时需要重点备份 `nextcloud` 数据目录、数据库和应用配置。反向代理后还要检查 `trusted_domains`、HTTPS 和上传文件大小限制。
:::
