Internal Server Error on Synology

Hi,
On a synology NAS DS216+II, running DSM 7.2.1-69057 Update 5 (so the last available), Nextcloud from linuxserver is installed through Docker. I installed it at the end of June, following the tutorial available here :

I used the second method explained (nextcloud + mariadb).

I used the following script during installation:

---
services:
  nextcloud:
    image: lscr.io/linuxserver/nextcloud:latest
    container_name: nextcloud
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Europe/Paris
    volumes:
      - ./config:/config
      - ./data:/data
    ports:
      - 9321:443
    restart: unless-stopped  
  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: nextcloud-mariadb
    environment:
      - PUID=1026
      - PGID=100
      - TZ=Europe/Paris
      - MYSQL_ROOT_PASSWORD=XXXXXXXXXXXXXXXXXX
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=XXXXXXXXXXXX
#      - REMOTE_SQL=http://URL1/your.sql,https://URL2/your.sql #optional
    volumes:
      - ./db-config:/config
    ports:
      - 9123:3306
    restart: unless-stopped

Nextcloud had worked for several days but for about 2 weeks I can’t connect again (for my network or from outside using quickconnect, with my laptop or my mobile phone).

The error is the following:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

The NAS is on and I can connect to the DSM without any problem.

Could anyone help me please?
You will probably need some other informations. Please be quick detailed in your questions as I am quite beginner with NAS/nextcloud. Thanks for your understanding.

Thanks a lot.

Regards,

Fabien

An Internal Server Error is a relatively generic error. To figure out what’s really going on you’ll need to check your web server and Nextcloud logs. Since you’re using the LSIO image: nextcloud - LinuxServer.io

The first command (exec) at that URL can be used to check the contents of your nextcloud.log (which by default is located in your datadirectory). Since you’re using what are called bind mounts in Docker, it appears from your config you may be able to access your Nextcloud log directly from your host (Synology) as well wherever you have ./data residing.

That second command at the above URL will give you the container logs, which I believe with LSIO will contain your web server logs (though I’m not sure it’ll include error logs offhand).

The first spot in particular should offer some hints as to what is going on.

Hi,
Thanks for your answer.
I check the Nextcloud log (located in docker/nextcloud/data/) which is quite big. (3Mo). I just tried to connect again to nextcloud from my web browser on my laptop few minutes ago (at 16h50, Paris time) but the last save of this file is dated the 6th july. So I’m not sure that it will give us interesting information. Nevertheless, please find below the 2 last lines (after removing port and adress). The previous one seems to be the same but 1h before and so on (about 1470 lines in the whole file)

{"reqId":"AAAAAAAAAAAAA","level":3,"time":"2024-07-06T11:10:11+00:00","remoteAddr":"","user":"--","app":"richdocuments","method":"","url":"--","message":"Failed to fetch capabilities: cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 47 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/capabilities","userAgent":"--","version":"29.0.3.4","exception":{"Exception":"GuzzleHttp\\Exception\\ConnectException","Message":"cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 47 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/capabilities","Code":0,"Trace":[{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php","line":158,"function":"createRejection","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php","line":110,"function":"finishError","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlHandler.php","line":47,"function":"finish","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":142,"function":"__invoke","class":"GuzzleHttp\\Handler\\CurlHandler","type":"->"},{"file":"/app/www/public/lib/private/Http/Client/DnsPinMiddleware.php","line":123,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php","line":35,"function":"OC\\Http\\Client\\{closure}","class":"OC\\Http\\Client\\DnsPinMiddleware","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":31,"function":"__invoke","class":"GuzzleHttp\\PrepareBodyMiddleware","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php","line":71,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":66,"function":"__invoke","class":"GuzzleHttp\\RedirectMiddleware","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php","line":75,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Client.php","line":333,"function":"__invoke","class":"GuzzleHttp\\HandlerStack","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Client.php","line":169,"function":"transfer","class":"GuzzleHttp\\Client","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Client.php","line":189,"function":"requestAsync","class":"GuzzleHttp\\Client","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/lib/private/Http/Client/Client.php","line":230,"function":"request","class":"GuzzleHttp\\Client","type":"->"},{"file":"/config/www/nextcloud/apps/richdocuments/lib/Service/CapabilitiesService.php","line":142,"function":"get","class":"OC\\Http\\Client\\Client","type":"->"},{"file":"/config/www/nextcloud/apps/richdocuments/lib/Service/CachedRequestService.php","line":75,"function":"sendRequest","class":"OCA\\Richdocuments\\Service\\CapabilitiesService","type":"->"},{"file":"/config/www/nextcloud/apps/richdocuments/lib/Backgroundjobs/ObtainCapabilities.php","line":46,"function":"fetch","class":"OCA\\Richdocuments\\Service\\CachedRequestService","type":"->"},{"file":"/app/www/public/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\Richdocuments\\Backgroundjobs\\ObtainCapabilities","type":"->"},{"file":"/app/www/public/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/app/www/public/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/app/www/public/cron.php","line":177,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php","Line":210,"message":"Failed to fetch capabilities: cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 47 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/capabilities","exception":{},"CustomMessage":"Failed to fetch capabilities: cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 47 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/capabilities"}}
{"reqId":"AAAAAAAAAAAAA","level":3,"time":"2024-07-06T11:10:11+00:00","remoteAddr":"","user":"--","app":"richdocuments","method":"","url":"--","message":"Failed to fetch discovery: cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 53 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/discovery","userAgent":"--","version":"29.0.3.4","exception":{"Exception":"GuzzleHttp\\Exception\\ConnectException","Message":"cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 53 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/discovery","Code":0,"Trace":[{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php","line":158,"function":"createRejection","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php","line":110,"function":"finishError","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlHandler.php","line":47,"function":"finish","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":142,"function":"__invoke","class":"GuzzleHttp\\Handler\\CurlHandler","type":"->"},{"file":"/app/www/public/lib/private/Http/Client/DnsPinMiddleware.php","line":123,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php","line":35,"function":"OC\\Http\\Client\\{closure}","class":"OC\\Http\\Client\\DnsPinMiddleware","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":31,"function":"__invoke","class":"GuzzleHttp\\PrepareBodyMiddleware","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php","line":71,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":66,"function":"__invoke","class":"GuzzleHttp\\RedirectMiddleware","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php","line":75,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Client.php","line":333,"function":"__invoke","class":"GuzzleHttp\\HandlerStack","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Client.php","line":169,"function":"transfer","class":"GuzzleHttp\\Client","type":"->"},{"file":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Client.php","line":189,"function":"requestAsync","class":"GuzzleHttp\\Client","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/app/www/public/lib/private/Http/Client/Client.php","line":230,"function":"request","class":"GuzzleHttp\\Client","type":"->"},{"file":"/config/www/nextcloud/apps/richdocuments/lib/Service/DiscoveryService.php","line":75,"function":"get","class":"OC\\Http\\Client\\Client","type":"->"},{"file":"/config/www/nextcloud/apps/richdocuments/lib/Service/CachedRequestService.php","line":75,"function":"sendRequest","class":"OCA\\Richdocuments\\Service\\DiscoveryService","type":"->"},{"file":"/config/www/nextcloud/apps/richdocuments/lib/Backgroundjobs/ObtainCapabilities.php","line":52,"function":"fetch","class":"OCA\\Richdocuments\\Service\\CachedRequestService","type":"->"},{"file":"/app/www/public/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OCA\\Richdocuments\\Backgroundjobs\\ObtainCapabilities","type":"->"},{"file":"/app/www/public/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/app/www/public/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/app/www/public/cron.php","line":177,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/app/www/public/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php","Line":210,"message":"Failed to fetch discovery: cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 53 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/discovery","exception":{},"CustomMessage":"Failed to fetch discovery: cURL error 7: Failed to connect to abcdefgh.direct.quickconnect.to port port after 53 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://abcdefgh.direct.quickconnect.to:port/apps/richdocumentscode/proxy.php?req=/hosting/discovery"}}

files here:

Thx

I just tried to connect again to nextcloud from my web browser on my laptop few minutes ago (at 16h50, Paris time) but the last save of this file is dated the 6th july.

Hmm. That suggests something either outside of Nextcloud (i.e. web server) or maybe something with your file permissions that is preventing Nextcloud from logging.

The LSIO image is a third party image, but I believe the following may help you track it down:

docker exec -it nextcloud touch /data/nextcloud.log ← does this succeed w/o error?
docker exec -it nextcloud occ config:list system ← to see how functioning Nc is

I believe LSIO sets the Nginx logs to go to /config/log/nginx. You should find an access log that is updated when you try to connect/trigger the internal server error. There should also be an error log in that same folder.

Hi John. thanks for your answer and sorry for the delay.

I connect to my NAS in ssh in my linux terminal and write the 2 commands you suggested:
First :

$ docker exec -it nextcloud touch /data/nextcloud.log
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/nextcloud/json": dial unix /var/run/docker.sock: connect: permission denied

Second:

$ docker exec -it nextcloud occ config:list system
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/nextcloud/json": dial unix /var/run/docker.sock: connect: permission denied```

With sudo :
First (no error) :

$ sudo docker exec -it nextcloud touch /data/nextcloud.log
Password: 

Second:

sudo docker exec -it nextcloud occ config:list system
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory in /app/www/public/lib/private/DB/Connection.php:163
Stack trace:
#0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(453): OC\DB\Connection->connect()
#1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(411): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(318): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /app/www/public/lib/private/DB/ConnectionAdapter.php(200): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(121): OC\DB\ConnectionAdapter->getDatabasePlatform()
#5 /app/www/public/lib/private/AppConfig.php(1239): OC\DB\QueryBuilder\QueryBuilder->expr()
#6 /app/www/public/lib/private/AppConfig.php(264): OC\AppConfig->loadConfig()
#7 /app/www/public/lib/private/AppConfig.php(1380): OC\AppConfig->searchValues()
#8 /app/www/public/lib/private/App/AppManager.php(131): OC\AppConfig->getValues()
#9 /app/www/public/lib/private/App/AppManager.php(152): OC\App\AppManager->getInstalledAppsValues()
#10 /app/www/public/lib/private/legacy/OC_App.php(234): OC\App\AppManager->getInstalledApps()
#11 /app/www/public/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#12 /app/www/public/lib/base.php(706): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#13 /app/www/public/lib/base.php(1181): OC::init()
#14 /app/www/public/console.php(48): require_once('...')
#15 /app/www/public/occ(11): require_once('...')
#16 {main}

It seems that there is a problem with the database right?

It does appear that way. Maybe check the state of your db container and the Docker logs for it.

Going back and reviewing your Docker Compose, it doesn’t appear you specified your db config for Nextcloud in there. So I presume you manually entered it into your config/config.php. Probably worth double-checking that too, to make sure all the db* parameters seem reasonable.

Both container are up

For me, db_config is specified in docker compose for database.

- ./db-config:/config

the config file :

<?php
$CONFIG = array (
  'instanceid' => 'ZZZZZZZZZ',
  'passwordsalt' => 'EEEEEEEEEEEEE',
  'secret' => 'TTTTTTTTTTTTTTTTT',
  'trusted_domains' => 
  array (
    0 => 'lan ip aaaa',
    1 => 'https://XXXXX.direct.quickconnect.to',
    2 => 'https://XXXXX.direct.quickconnect.to/nextcloud/',
    3 => 'XXXXX.direct.quickconnect.to/nextcloud',
    4 => 'XXXXX.direct.quickconnect.to',
    5 => 'yyyyyyy.net:port',
    6 => 'yyyyyyy.net',
    7 => 'XXXXX.direct.quickconnect.to:port/nextcloud',
    8 => 'XXXXX.direct.quickconnect.to:port',
  ),
  'datadirectory' => '/volume1/web/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '29.0.1.1',
  'overwrite.cli.url' => 'https://lan ip aaaa/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'TTTTT',
  'dbpassword' => 'blablablablabla',
  'installed' => true,
);