Nextcloud doesn't work as intended

I can’t do dnsdomain.com/nextcloud anymore nor it appears as if nextcloud is installed with the “dietpi-services command”.

I can’t reinstall it, I don’t know what happened.

Update: restarted nginx and it works partially (the Windows app works)
When I try to access the website, I get this error:

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

Nextcloud is not an own application. It’s a web server app. Therefore you don’t see it. Can you check

dietpi-services status
[  OK  ] DietPi-Services | nmbd                  active (running) since Mon 2023-04-03 11:49:18 BST; 21min ago
[  OK  ] DietPi-Services | smbd                  active (running) since Mon 2023-04-03 11:49:18 BST; 21min ago
[  OK  ] DietPi-Services | redis-server          active (running) since Mon 2023-04-03 11:49:19 BST; 21min ago
[  OK  ] DietPi-Services | mariadb               active (running) since Mon 2023-04-03 11:49:25 BST; 21min ago
[  OK  ] DietPi-Services | php7.4-fpm            active (running) since Mon 2023-04-03 11:49:26 BST; 21min ago
[  OK  ] DietPi-Services | nginx                 active (running) since Mon 2023-04-03 11:49:26 BST; 21min ago
[  OK  ] DietPi-Services | aria2                 active (running) since Mon 2023-04-03 11:49:26 BST; 21min ago
[  OK  ] DietPi-Services | cron                  active (running) since Mon 2023-04-03 11:49:26 BST; 21min ago
[  OK  ] DietPi-Services | dropbear              active (running) since Mon 2023-04-03 11:49:16 BST; 21min ago
[ INFO ] DietPi-Services | dietpi-vpn            inactive (dead)
[ INFO ] DietPi-Services | dietpi-cloudshell     inactive (dead)
[  OK  ] DietPi-Services | dietpi-ramlog         active (exited) since Mon 2023-04-03 11:49:16 BST; 21min ago
[  OK  ] DietPi-Services | dietpi-preboot        active (exited) since Mon 2023-04-03 11:49:17 BST; 21min ago
[  OK  ] DietPi-Services | dietpi-postboot       active (exited) since Mon 2023-04-03 11:49:17 BST; 21min ago
[ INFO ] DietPi-Services | dietpi-wifi-monitor   inactive (dead)

Should also Let’s Encrypt appear here?

This is not a service.

Pls reboot your system and try to connect afterwards. Once done, have a look to last 100 lines of NC log

tail -100 /mnt/dietpi_userdata/nextcloud/nextcloud.log

tail: cannot open ‘/mnt/dietpi_userdata/nextcloud/nextcloud.log’ for reading: No such file or directory

ahh wrong path. Following should do

tail -100 /mnt/dietpi_userdata/nextcloud_data/nextcloud.log

https://pastebin.com/raw/iJHzAAMQ
I think it has to do with folder permissions now, I might’ve messed them up when I tried to make Jellyfin access the nextcloud folders

How does folder permissions looks like

ls -la /var/www/nextcloud/
ls: cannot access '/var/www/nextcloud/ls': No such file or directory
/var/www/nextcloud/:
total 176
drwxr-xr-x 14 www-data www-data  4096 Mar 28 18:54 .
drwxr-xr-x  4 root     root      4096 Mar  8 22:46 ..
-rw-r--r--  1 www-data www-data  3366 Mar 28 18:55 .htaccess
-rw-r--r--  1 www-data www-data   101 Mar 28 18:54 .user.ini
drwxr-xr-x 47 www-data www-data  4096 Mar 28 18:54 3rdparty
-rw-r--r--  1 www-data www-data 19327 Mar 28 18:54 AUTHORS
-rw-r--r--  1 www-data www-data 34520 Mar 28 18:54 COPYING
drwxr-xr-x 66 www-data www-data  4096 Mar 28 18:56 apps
drwxr-xr-x  2 www-data www-data  4096 Mar 28 18:55 config
-rw-r--r--  1 www-data www-data  4095 Mar 28 18:54 console.php
drwxr-xr-x 23 www-data www-data  4096 Mar 28 18:55 core
-rw-r--r--  1 www-data www-data  6317 Mar 28 18:54 cron.php
drwxr-xr-x  2 www-data www-data 12288 Mar 28 18:54 dist
-rw-r--r--  1 www-data www-data   156 Mar 28 18:54 index.html
-rw-r--r--  1 www-data www-data  3456 Mar 28 18:55 index.php
drwxr-xr-x  6 www-data www-data  4096 Mar 28 18:54 lib
-rw-r--r--  1 www-data www-data   283 Mar 28 18:54 occ
drwxr-xr-x  2 www-data www-data  4096 Mar 28 18:54 ocm-provider
drwxr-xr-x  2 www-data www-data  4096 Mar 28 18:54 ocs
drwxr-xr-x  2 www-data www-data  4096 Mar 28 18:54 ocs-provider
-rw-r--r--  1 www-data www-data  3139 Mar 28 18:55 public.php
-rw-r--r--  1 www-data www-data  5549 Mar 28 18:55 remote.php
drwxr-xr-x  4 www-data www-data  4096 Mar 28 18:54 resources
-rw-r--r--  1 www-data www-data    26 Mar 28 18:54 robots.txt
-rw-r--r--  1 www-data www-data  2452 Mar 28 18:55 status.php
drwxr-xr-x  3 www-data www-data  4096 Mar 28 18:54 themes
drwxr-xr-x  2 www-data www-data  4096 Dec  8 11:27 updater
-rw-r--r--  1 www-data www-data   383 Mar 28 18:54 version.php

Those look fine, and the ones of /mnt/dietpi_userdata/nextcloud_data (which you most likely tried to grant Jellyfin access to)?

In your logs there is also this massively repeating error:

{"reqId":"GHeuvAlK67t7Cgw471Oh","level":4,"time":"2023-04-03T15:54:44+00:00","remoteAddr":"85.251.86.127","user":"admin","app":"no app in context","method":"GET","url":"/nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications?format=json","message":"Could not boot richdocuments: fwrite() expects parameter 1 to be resource, bool given","userAgent":"Mozilla/5.0 (Windows) mirall/3.8.0stable-Win64 (build 20230331) (Nextcloud, windows-10.0.19044 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.5.1","exception":{"Exception":"TypeError","Message":"fwrite() expects parameter 1 to be resource, bool given","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Security/CertificateManager.php","line":161,"function":"fwrite"},{"file":"/var/www/nextcloud/lib/private/Security/CertificateManager.php","line":247,"function":"createCertificateBundle","class":"OC\\Security\\CertificateManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/Http/Client/Client.php","line":127,"function":"getAbsoluteBundlePath","class":"OC\\Security\\CertificateManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/Http/Client/Client.php","line":74,"function":"getCertBundle","class":"OC\\Http\\Client\\Client","type":"->"},{"file":"/var/www/nextcloud/lib/private/Http/Client/Client.php","line":218,"function":"buildRequestOptions","class":"OC\\Http\\Client\\Client","type":"->"},{"file":"/var/www/nextcloud/apps/richdocuments/lib/Service/CapabilitiesService.php","line":136,"function":"get","class":"OC\\Http\\Client\\Client","type":"->"},{"file":"/var/www/nextcloud/apps/richdocuments/lib/Service/CapabilitiesService.php","line":74,"function":"refetch","class":"OCA\\Richdocuments\\Service\\CapabilitiesService","type":"->"},{"file":"/var/www/nextcloud/apps/richdocuments/lib/AppInfo/Application.php","line":80,"function":"getCapabilities","class":"OCA\\Richdocuments\\Service\\CapabilitiesService","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/FunctionInjector.php","line":67,"function":"OCA\\Richdocuments\\AppInfo\\{closure}","class":"OCA\\Richdocuments\\AppInfo\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/BootContext.php","line":51,"function":"injectFn","class":"OC\\AppFramework\\Bootstrap\\FunctionInjector","type":"->"},{"file":"/var/www/nextcloud/apps/richdocuments/lib/AppInfo/Application.php","line":135,"function":"injectFn","class":"OC\\AppFramework\\Bootstrap\\BootContext","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":190,"function":"boot","class":"OCA\\Richdocuments\\AppInfo\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":208,"function":"bootApp","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":141,"function":"loadApp","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":57,"function":"loadApps","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Security/CertificateManager.php","Line":161,"message":"Could not boot richdocuments: fwrite() expects parameter 1 to be resource, bool given","exception":{},"CustomMessage":"Could not boot richdocuments: fwrite() expects parameter 1 to be resource, bool given"}}

It doesn’t really tell me something. fwrite() expects parameter 1 to be resource, bool given sounds like a false was given to a function. Not sure whether it is related to permission issues. Let’s see.

drwxrwx---  8 www-data www-data     4096 Jan 21 22:08 .
drwxrwxr-x 11 dietpi   dietpi       4096 Mar 28 20:07 ..
-rw-r--r--  1 www-data www-data      542 Mar 28 18:55 .htaccess
-rw-r--r--  1 www-data www-data        0 Mar 28 18:55 .ocdata
drwxr-xr-x  8 www-data www-data     4096 Jan  5 17:21 admin
drwxr-xr-x  5 www-data www-data     4096 Jan 22 13:26 anime
drwxrwx--- 13 www-data www-data     4096 Jan  5 17:35 appdata_ocwqz0z7w7p3
drwxrwx---  2 jellyfin root         4096 Jan  5 18:01 aria2
drwxrwx---  2 jellyfin root         4096 Mar 28 18:55 files_external
-rw-r--r--  1 www-data www-data        0 Jan  3 22:55 flow.log
-rw-r--r--  1 www-data www-data        0 Mar 28 18:55 index.html
-rw-r-----  1 www-data www-data 78935677 Apr  4 08:41 nextcloud.log
drwxr-xr-x  4 www-data www-data     4096 Mar 28 18:56 updater-ocwqz0z7w7p3
-rw-r--r--  1 www-data www-data    36044 Mar 28 18:55 updater.log

They all look fine to me, and the folder that I made Jellyfin access within the “Admin” folder also has “www-data”

These folders seems to have incorrect permission. Usually all folder needs to be owned by the web server user www-data.

how can i change the permissions of those two?

The aria2 seems to be not from Nextcloud, at least it isn’t known to me, but files_external is a default Nextcloud directory which must be writable to the www-data user and is currently not:

sudo chown -R www-data:www-data /mnt/dietpi_userdata/nextcloud_data/files_external

If you need Jellyfin to have read access, add it to the www-data group:

sudo usermod -aG www-data jellyfin

It currently looks like this would grant it write access as well, but this is not needed and Jellyfin does not/cannot change media files, does it? That should not be done directly to the Nextcloud data directory but only via WebDAV API or to a directory which is added as “external storage” to Nextcloud.

Aria2 is a downloader I installed for a Nextcloud “extension/plugin”, however it is not essencial to the app.

sudo chown -R www-data:www-data /mnt/dietpi_userdata/nextcloud_data/files_external

Did this command and still nothing.

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.

maybe better to reset whole /mnt/dietpi_userdata/nextcloud_data/ back to user www-data? Just in case other folder have incorrect permissions as well?

And maybe a restart of whole system

would that be
sudo chown -R www-data:www-data /mnt/dietpi_userdata/nextcloud_data/
then
reboot?

yes, that would be the commnds

my ssh terminal lagged when i typed
sudo chown -R www-data:www-data /mnt/dietpi_userdata/nextcloud_data/
should it be
sudo chown -R www-data:www-data /mnt/dietpi_userdata/nextcloud_data?