Internal server error on new Nextcloud

In the past I used to install nextcloud with the snap package, however I am now trying to install it manually for better performance and for v21 (is it really?). BTW I’m a begginer with this kind of stuff so maybe this is a stupid problem.
I followed the example installation on Nextcloud’s manual on Ubuntu 20.04 LTS, and configured apache with the topic “Linux Installation”.
However, when I enter my website via the browser it throws an internal server error, and tells me to look at the logs.
Where are the logs located? I think it would be useful to solve this problem.
I found some logs on on /var/log/apache2/error.log:

[Mon Mar 08 01:29:23.090757 2021] [mpm_event:notice] [pid 42961:tid 139867896781888] AH00489: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Mar 08 01:29:23.090907 2021] [core:notice] [pid 42961:tid 139867896781888] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 08 01:38:13.756899 2021] [mpm_event:notice] [pid 42961:tid 139867896781888] AH00491: caught SIGTERM, shutting down
[Mon Mar 08 01:38:13.844137 2021] [mpm_prefork:notice] [pid 47759] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Mar 08 01:38:13.844256 2021] [core:notice] [pid 47759] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 08 01:38:15.192604 2021] [mpm_prefork:notice] [pid 47759] AH00169: caught SIGTERM, shutting down
[Mon Mar 08 01:38:15.719482 2021] [mpm_prefork:notice] [pid 47835] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Mar 08 01:38:15.719551 2021] [core:notice] [pid 47835] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 08 01:49:14.082779 2021] [mpm_prefork:notice] [pid 47835] AH00169: caught SIGTERM, shutting down
[Mon Mar 08 01:49:14.229724 2021] [mpm_prefork:notice] [pid 48614] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Mar 08 01:49:14.229791 2021] [core:notice] [pid 48614] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 08 01:49:23.674599 2021] [php7:notice] [pid 48618] [client 192.168.15.99:35598] {"reqId":"8o7BotU85XKtetrejh9D","level":3,"time":"2021-03-08T01:49:23+00:00","remoteAddr":"192.168.15.99","user":"--","app":"PHP","method":"GET","url":"/nextcloud/","message":{"Exception":"Error","Message":"touch(): Unable to create file /var/www/nextcloud/config/config.php because Permission denied at /var/www/nextcloud/lib/private/Config.php#247","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":247,"function":"touch"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:23.674808 2021] [php7:notice] [pid 48618] [client 192.168.15.99:35598] {"reqId":"8o7BotU85XKtetrejh9D","level":3,"time":"2021-03-08T01:49:23+00:00","remoteAddr":"192.168.15.99","user":"--","app":"PHP","method":"GET","url":"/nextcloud/","message":{"Exception":"Error","Message":"fopen(/var/www/nextcloud/config/config.php): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Config.php#248","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":248,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:23.674993 2021] [php7:notice] [pid 48618] [client 192.168.15.99:35598] {"reqId":"8o7BotU85XKtetrejh9D","level":3,"time":"2021-03-08T01:49:23+00:00","remoteAddr":"192.168.15.99","user":"--","app":"PHP","method":"GET","url":"/nextcloud/","message":{"Exception":"Error","Message":"chmod(): No such file or directory at /var/www/nextcloud/lib/private/Config.php#251","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":251,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:23.714138 2021] [php7:notice] [pid 48618] [client 192.168.15.99:35598] {"reqId":"8o7BotU85XKtetrejh9D","level":3,"time":"2021-03-08T01:49:23+00:00","remoteAddr":"192.168.15.99","user":"--","app":"index","method":"GET","url":"/nextcloud/","message":{"Exception":"OC\\\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Config.php","Line":255,"Hint":"This can usually be fixed by giving the webserver write access to the config directory.","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:23.714342 2021] [php7:notice] [pid 48618] [client 192.168.15.99:35598] {"reqId":"8o7BotU85XKtetrejh9D","level":3,"time":"2021-03-08T01:49:23+00:00","remoteAddr":"192.168.15.99","user":"--","app":"index","method":"GET","url":"/nextcloud/","message":{"Exception":"Doctrine\\\\DBAL\\\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [14] unable to open database file","Code":14,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1486,"function":"connect","class":"OC\\\\DB\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1014,"function":"getWrappedConnection","class":"Doctrine\\\\DBAL\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":226,"function":"executeQuery","class":"Doctrine\\\\DBAL\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":210,"function":"executeQuery","class":"OC\\\\DB\\\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":286,"function":"execute","class":"Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":345,"function":"execute","class":"OC\\\\DB\\\\QueryBuilder\\\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":110,"function":"loadConfigValues","class":"OC\\\\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppConfig.php","line":301,"function":"getApps","class":"OC\\\\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":136,"function":"getValues","class":"OC\\\\AppConfig","type":"->"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":225,"function":"getInstalledAppsValues","class":"OC\\\\App\\\\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":284,"function":"isEnabledForUser","class":"OC\\\\App\\\\AppManager","type":"->"},{"file":"/var/www/nextcloud/index.php","line":45,"function":"printErrorPage","class":"OC_Template","type":"::"}],"File":"/var/www/nextcloud/lib/private/DB/Connection.php","Line":85,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:23.735188 2021] [php7:notice] [pid 48618] [client 192.168.15.99:35598] {"reqId":"8o7BotU85XKtetrejh9D","level":3,"time":"2021-03-08T01:49:23+00:00","remoteAddr":"192.168.15.99","user":"--","app":"PHP","method":"GET","url":"/nextcloud/","message":"fopen(/var/www/nextcloud/data/nextcloud.log): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Log/File.php#85","userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:55.357489 2021] [mpm_prefork:notice] [pid 48614] AH00169: caught SIGTERM, shutting down
[Mon Mar 08 01:49:55.517271 2021] [mpm_prefork:notice] [pid 48687] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Mon Mar 08 01:49:55.517456 2021] [core:notice] [pid 48687] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 08 01:49:59.215006 2021] [php7:notice] [pid 48688] [client 192.168.15.99:35618] {"reqId":"ti8bqOguLDd2alHMCGiu","level":3,"time":"2021-03-08T01:49:59+00:00","remoteAddr":"192.168.15.99","user":"--","app":"PHP","method":"GET","url":"/nextcloud/","message":{"Exception":"Error","Message":"touch(): Unable to create file /var/www/nextcloud/config/config.php because Permission denied at /var/www/nextcloud/lib/private/Config.php#247","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":247,"function":"touch"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:59.215683 2021] [php7:notice] [pid 48688] [client 192.168.15.99:35618] {"reqId":"ti8bqOguLDd2alHMCGiu","level":3,"time":"2021-03-08T01:49:59+00:00","remoteAddr":"192.168.15.99","user":"--","app":"PHP","method":"GET","url":"/nextcloud/","message":{"Exception":"Error","Message":"fopen(/var/www/nextcloud/config/config.php): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Config.php#248","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":248,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:59.215852 2021] [php7:notice] [pid 48688] [client 192.168.15.99:35618] {"reqId":"ti8bqOguLDd2alHMCGiu","level":3,"time":"2021-03-08T01:49:59+00:00","remoteAddr":"192.168.15.99","user":"--","app":"PHP","method":"GET","url":"/nextcloud/","message":{"Exception":"Error","Message":"chmod(): No such file or directory at /var/www/nextcloud/lib/private/Config.php#251","Code":0,"Trace":[{"function":"onError","class":"OC\\\\Log\\\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":251,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:59.255127 2021] [php7:notice] [pid 48688] [client 192.168.15.99:35618] {"reqId":"ti8bqOguLDd2alHMCGiu","level":3,"time":"2021-03-08T01:49:59+00:00","remoteAddr":"192.168.15.99","user":"--","app":"index","method":"GET","url":"/nextcloud/","message":{"Exception":"OC\\\\HintException","Message":"Can't write into config directory!","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Config.php","line":137,"function":"writeData","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/SystemConfig.php","line":111,"function":"setValue","class":"OC\\\\Config","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":1173,"function":"setValue","class":"OC\\\\SystemConfig","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":413,"function":"getInstanceId","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":639,"function":"initSession","class":"OC","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Config.php","Line":255,"Hint":"This can usually be fixed by giving the webserver write access to the config directory.","CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36","version":""}
[Mon Mar 08 01:49:59.255341 2021] [php7:notice] [pid 48688] [client 192.168.15.99:35618] {"reqId":"ti8bqOguLDd2alHMCGiu","level":3,"time":"2021-03-08T01:49:59+00:00","remoteAddr":"192.168.15.99","user":"--","app":"index","method":"GET","url":"/nextcloud/","message":{"Exception":"Doctrine\\\\DBAL\\\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [14] unable to open database

That is just a little snippet from the logs, as it is really long.
Apparently something with database, I don’t know.

Did you do the chown-Step? chown -R www-data:www-data /var/www/nextcloud/
I typically know this behaviour, if i miss that.
Would also match this log-line:

Unable to create file /var/www/nextcloud/config/config.php because Permission denied
1 Like

Thank you, that was the problem xD

1 Like