I have a fairly standard setup, with nginx as a web frontend (with https certiticates and such) and a nextcloud FPM backend; the whole installation has very low traffic, since I am the only one using it.
At one point https stops working, every connection from outside results in either timeout or connection refused; in this situation it seem that nextcloud is working and nginx isn't. I thought it may have to do with some energy saving on my host, but it's not the case, since all the other containers on the same host work just fine; the funny thing is that there is a simple way to make it work again and it is to open a shell on the host and do:
cd $NEXTCLOUD_DIRECTORY
where NEXTCLOUD_DIRECTORY is the base directory for the application, where both docker-compose.yml file and data directories are (located at $HOME/docker/nextcloud-letsencrypt).
I just don't understand why this is happening and why that operation is a solution...
Here is my compose file:
version: '3'
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
- "127.0.0.1:8443:443"
volumes:
- ./data/nginx:/etc/nginx/conf.d
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
- ./data/nextcloud/www:/var/www/html:ro
- ./data/nextcloud/apps:/var/www/html/custom_apps:ro
restart: unless-stopped
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
restart: unless-stopped
cloud-db:
container_name: ${DB_CONTAINER_NAME}
image: mariadb:${DB_IMAGE_TAG}
restart: unless-stopped
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
...
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
app:
image: nextcloud:21-fpm-alpine
links:
- cloud-db
user: "1000:1004"
volumes:
- ./data/nextcloud/www:/var/www/html
- ./data/nextcloud/apps:/var/www/html/custom_apps
- ./data/nextcloud/config:/var/www/html/config
- /mnt/usb/shared/nextcloud:/var/www/html/data
- /mnt/usb/Expansion_2/serie:/mnt/serie:ro
- /mnt/usb/archivio/archivio:/mnt/archivio:ro
restart: unless-stopped
./data is in the root FS, inside user 1000's home directory.
/mnt/usb/shared/nextcloud is on an ext4 USB drive (ext4 defaults,nofail 0 0), R/W to the user
/mnt/usb/Expansion_2 is another ex4 USB drive (ext4 defaults,nofail 0 0) served through NC (they are registered as external storage in NC)