switch nextcloud to FPM + Nginx for better static file performance

Replace the all-in-one Apache image with nextcloud:33-fpm and an Nginx
sidecar that serves static assets directly with gzip compression and
cache headers, avoiding the prefork concurrency bottleneck.
This commit is contained in:
2026-03-22 17:00:33 +01:00
parent c0c20a42ed
commit 4329cfd3f2
3 changed files with 94 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
services:
nextcloud:
image: nextcloud:33-apache
image: nextcloud:33-fpm
container_name: nextcloud
restart: unless-stopped
depends_on:
@@ -19,6 +19,29 @@ services:
- ${DATA_ROOT}/nextcloud/data:/var/www/html/data
- ./hooks/post-installation.sh:/docker-entrypoint-hooks.d/post-installation/post-installation.sh:ro
- ./hooks/post-upgrade.sh:/docker-entrypoint-hooks.d/post-upgrade/post-upgrade.sh:ro
networks:
- nextcloud-internal
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
nginx:
image: nginx:alpine
container_name: nextcloud-nginx
restart: unless-stopped
depends_on:
- nextcloud
volumes:
- ${DATA_ROOT}/nextcloud/html:/var/www/html:ro
- ${DATA_ROOT}/nextcloud/data:/var/www/html/data:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost/status.php || exit 1"]
interval: 30s
timeout: 10s
retries: 3
networks:
- proxy
- nextcloud-internal
@@ -27,11 +50,6 @@ services:
options:
max-size: "10m"
max-file: "3"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/status.php"]
interval: 30s
timeout: 10s
retries: 3
postgres:
image: postgres:17-alpine
@@ -68,7 +86,7 @@ services:
max-file: "3"
cron:
image: nextcloud:33-apache
image: nextcloud:33-fpm
container_name: nextcloud-cron
restart: unless-stopped
depends_on: