Server error 500 when accessing from a browser


I have the nextcloud server on a raspberry pi with Docker (docker-compose) and Traefik as reverse proxy. Nextcloud is working on an external hard drive.

I access nextcloud from a Ubunty client and an Android client.
Recently I deleted the data from my Android client due to lack of space, although I do not know if it is related to this problem or is it a coincidence.

The issue is that although the nextcloud server seems to work fine, it gives me an error when trying to connect from any web browser (phone, computer, etc).

This is the nextcloud log:


[Mon Aug 30 21:32:20.411115 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.22 configured -- resuming normal operations

[Mon Aug 30 21:32:20.411275 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

192.168.xx.xx - - [30/Aug/2021:21:32:40 +0200] "GET / HTTP/1.1" 500 717 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"

Also nextcloud has stopped syncing with Ubuntu, it gives me this error:

"500 internal server error"

MY docker-compose.yml

    image: nextcloud:latest
    container_name: nextcloud
    restart: unless-stopped
      - mariadb
      - redis
      - traefik
      - TZ=${TZ}
      - REDIS_HOST=redis
      - ${MI_DOCKER}/nextcloud:/var/www/html
      - ${MI_DOCKER}/nextcloud/apps:/var/www/html/custom_apps
      - ${MI_DOCKER}/nextcloud/config:/var/www/html/config
      - ${DISCO_DATOSNUBE}/nextcloud:/var/www/html/data
      - traefik.enable=true
      - traefik.http.routers.nextcloud.rule=Host(`nextcloud.${MI_DOMINIO_4}`)
      - traefik.http.routers.nextcloud.entrypoints=websecure
      - traefik.http.routers.nextcloud.tls=true
      - traefik.http.routers.nextcloud.tls.certresolver=lets-encrypt
      - traefik.http.routers.nextcloud.middlewares=nc-rep,nc-header
      - internal
      - web

I still have all the data on the hard drive that nextcloud used. If I delete everything, including the database (mariadb), will Nextcloud be able to regenerate the mariadb database if I leave all the files on the hard drive?

If I have to delete nextcloue AGAIN, and reinstall it, I think I’ll give up … I’m spending more time trying to get nextcloud to work which I think is too much for me.

Thank you Group!!!

Yes, because if you did the mapping correctly the data contains db data of the instance only. I’m doing almost the same thing with docker and volume mapping to not lose my data when I e.g. update/upgrade to next (major) version (since version 17 or 18) and haven’t had any trouble until version 22.1.x (but this was MariaDB compress data related).
I do not use traefik (but reverse proxy and let’sencrypt too) and if you want I can share my working example (docker based) with you. Maybe it helps you to make it work and later you can figure out what the reason is and why it doesn’t work with traefik or whatever the reason is.

1 Like

means: something’s wrong with the backend service. e.g. database, redis, php.

did you try docker ps to check if all container are running? did you check the docker logs of the containers?

error 500 is not related to traefik. traefik would return 404 if it can’t to the nextcloud container.

yes and no. you’ll loose all user inforamtion and app settings if you use apps. also all shared links will be gone.

1 Like

ok, thank you MarsIMarcello!

Thank you very much, Reiner.

Mariadb and redis are ok, but i see a lot of errors in traefik, i think i will have to check it, then i will comment the results.

Regarding the loss of information, I do not care, if I lose the user and configuration information, as long as I do not lose the data and it is not necessary to upload it again.
Probably delete the nextcloud, mariadb and redis containers, and reinstall everything again but keeping the data on the hard drive, will I screw something up?

Thank you, Reineer:

I saw that traefik runs without problems, the same mariadb and redis both run without problems, they do not give any error message.

I have removed the nextcloud, mariadb and redis containers, as well as all the persistent information from them, but I have left the data that I was managing on my hard drive.
When starting nextcloud again with the same configuration and the same user, it gives me the message:

` Error: "the username is incorrect because the files already exist for this user"

I suppose it is because my data is associated with the user, do you think I can “trick” nextcloud to continue using my data without having to re-upload everything from scratch.


i would “move” my data in the data folder to a path outside of ${DISCO_DATOSNUBE}/nextcloud . or simply rename it to ${DISCO_DATOSNUBE}/nextcloud.old

clean everything up and restart all container.

then you have to look into ${DISCO_DATOSNUBE}/nextcloud.old/<your-name>/files and copy all needed files to ${DISCO_DATOSNUBE}/nextcloud/<your-name>/files

the other folder in ${DISCO_DATOSNUBE}/nextcloud.old should be irrelevant.

to rescan the files run: docker exec -u www-data nextcloud php occ files:scan --all

1 Like

Thank you very much Reiner, it worked perfectly, although as a precaution, before copying my data I put nextcloud in maintenance mode and reactivated it at the end of the copy before doing the “scan”.