Nextcloud: server replied: Bad Gateway

On a recently installed Nextcloud, I often run into the error message “server replied: Bad Gateway” on the sync client.

image

Installation host is an UCS member server running Kopano (in native mode, not as a docker container… was installed before introduction of containers in UCS) + Nextcloud installed via Appcenter in a container behind the Apache automatically configured as reverse proxy. Nextcloud is reachable from everywhere via HTTPS + correct Let’s Encrypt certificate.
Affected Nextcloud storage is AWS S3 and CIFS. This occurs even if I only use one type of storage. The server itself is mostly idling and serves just a couple of clients. No CPU spikes, low memory etc.

“sudo -u www-data php occ files:scan --all” in the docker container shows about 20.000 folders and 100.000 files in total.

Eventually, this error clears out itself and it indicates that all files are transfered - but it takes ages and is not reliable. Also, rescanning occurs quite often and takes long. I can’t be sure that all files have been transfered.

Any ideas where I could start to solve the problem?

How/whether Kopano might have any side effects here I cannot say.

Nextcloud sits behind the Apache reverse proxy on the host. Check it’s logs to see whether there is a problem on that side. Bad Gateway would point to it.

If there is nothing strange, check the web server logs in the Nextcloud container. You get shell access by univention-app shell nextcloud.

Yes, thank you, I also suspect the reverse proxy.
I had lots of themes for Wordpress, Magento etc. unpacked on my disk. These tend to have a very deep hierarchy and lots of small files. I then compressed them into Zip-files and it became better. Also, I nearly added everything folder-by-folder. Occassionally , the error happened again, but disappeared after several attempts.
So I suspect that the Nextcloud client runs into some kind of rate / connection limit on either the reverse proxy or the Nextcloud Apache.

Mastodon