Internal Server Error after Upgrading to Nextcloud 24

Nextcloud version 24
Operating system and version Raspberry Pi OS 11
Apache or nginx version: Apache/2.4.53 (Debian)
PHP version : PHP 8.0.18

The issue you are facing: Internal Server Error not able to load nextcloud

Is this the first time you’ve seen this error? Yes

The output of your config.php file in /path/to/nextcloud

<?php
$CONFIG = array (
  'instanceid' => 'XXXXX',
  'passwordsalt' => 'XXXX',
  'secret' => 'XXXX',
  'trusted_domains' =>
  array (
    0 => 'XXX',
    1 => 'XXX',
  ),
  'datadirectory' => '/home/Nextcloud',
  'dbtype' => 'mysql',
  'version' => '24.0.0.12',
  'overwrite.cli.url' => https://mydomain.com/nextcloud
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'htaccess.RewriteBase' => 'mydomain.com/nextcloud',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'maintenance' => false,
  'app_install_overwrite' =>
  array (
    0 => 'files_readmemd',
  ),
  'updater.secret' => 'XXX',
  'theme' => '',
  'loglevel' => 2,
);

The output of your Apache /var/log/apache2/error.log

[Fri May 06 09:44:47.798351 2022] [core:alert] [pid 181523] [client 147.161.183.93:11899] /var/www/html/nextcloud/.htaccess: RewriteBase: argument is not a valid URL
[Fri May 06 09:44:49.995845 2022] [core:alert] [pid 181546] [client 147.161.183.93:13303] /var/www/html/nextcloud/.htaccess: RewriteBase: argument is not a valid URL, referer: https://thewolves.cyou/nextcloud/index.php/apps/photos/service-worker.js
[Fri May 06 09:45:18.737588 2022] [core:alert] [pid 181524] [client 147.161.183.93:43698] /var/www/html/nextcloud/.htaccess: RewriteBase: argument is not a valid URL, referer: https://thewolves.cyou/nextcloud/index.php/apps/photos/service-worker.js

Excerpt from .htaccess in /var/www/html/nextcloud/.htaccess

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

ErrorDocument 403 /nextcloud/
ErrorDocument 404 /nextcloud/
<IfModule mod_rewrite.c>
  Options -MultiViews
  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
  RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]
  RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4|mp3|ogg|wav|wasm|tflite)$
  RewriteCond %{REQUEST_FILENAME} !/core/ajax/update\.php
  RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon\.ico|manifest\.json)$
  RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status)\.php
  RewriteCond %{REQUEST_FILENAME} !/ocs/v(1|2)\.php
  RewriteCond %{REQUEST_FILENAME} !/robots\.txt
  RewriteCond %{REQUEST_FILENAME} !/(ocm-provider|ocs-provider|updater)/
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$
  RewriteRule . index.php [PT,E=PATH_INFO:$1]
  RewriteBase mydomain.com/nextcloud
  <IfModule mod_env.c>
    SetEnv front_controller_active true
    <IfModule mod_dir.c>
      DirectorySlash off
    </IfModule>
  </IfModule>
</IfModule>

Any help would be greatly appreciated. I tried to provide all the information from my investigation so far but if there’s any other information I should provide please let me know. Thank you

Hi @meldarionqeusse , can you send your log of nextcloud ??? ( nextcloud.log by default in /var/www/nextcloud/data)


{"reqId":"RT6RHcV3cJSvN2OpHlcT","level":2,"time":"2022-02-10T18:12:53+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"GET","url":"/nextcloud/","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}
{"reqId":"RT6RHcV3cJSvN2OpHlcT","level":2,"time":"2022-02-10T18:12:53+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"GET","url":"/nextcloud/","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}
{"reqId":"gh0Tk5xq4hP30isGCpdD","level":2,"time":"2022-02-10T18:15:55+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"POST","url":"/nextcloud/index.php","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}
{"reqId":"gh0Tk5xq4hP30isGCpdD","level":2,"time":"2022-02-10T18:15:55+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"POST","url":"/nextcloud/index.php","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}
{"reqId":"gh0Tk5xq4hP30isGCpdD","level":3,"time":"2022-02-10T18:15:55+00:00","remoteAddr":"::1","user":"--","app":"PHP","method":"POST","url":"/nextcloud/index.php","message":"mkdir(): Permission denied at /var/www/html/nextcloud/lib/private/Setup.php#308","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":"","exception":{"Exception":"Error","Message":"mkdir(): Permission denied at /var/www/html/nextcloud/lib/private/Setup.php#308","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/html/nextcloud/lib/private/Setup.php","line":308,"function":"mkdir"},{"file":"/var/www/html/nextcloud/core/Controller/SetupController.php","line":74,"function":"install","class":"OC\\Setup","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/base.php","line":939,"function":"run","class":"OC\\Core\\Controller\\SetupController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}
{"reqId":"eH2q0xq99XMM9BBIK7Eh","level":2,"time":"2022-02-10T18:17:09+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"POST","url":"/nextcloud/index.php","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}
{"reqId":"eH2q0xq99XMM9BBIK7Eh","level":2,"time":"2022-02-10T18:17:09+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"POST","url":"/nextcloud/index.php","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}
{"reqId":"lt4E3U5T9HGnHvQMlFOo","level":2,"time":"2022-02-10T18:17:42+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"POST","url":"/nextcloud/index.php","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}
{"reqId":"lt4E3U5T9HGnHvQMlFOo","level":2,"time":"2022-02-10T18:17:42+00:00","remoteAddr":"::1","user":"--","app":"no app in context","method":"POST","url":"/nextcloud/index.php","message":"Host localhost was not connected to because it violates local access rules","userAgent":"Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.78 Safari/537.36","version":""}

I do not see any logs from today

I commented this line from my config.php

// 'htaccess.RewriteBase' => 'mydomain.com/nextcloud',

and ran sudo -u www-data php occ maintenance:update:htaccess and now it seems to work. Still I am not sure why it never gave me any problems for the past 2 years and it created a problem now with Nextcloud 24.

1 Like

@meldarionqeusse I don’t know why either but I’m glad it’s working for you again