Login Loop / Not Logged in Exception

Nextcloud version : 23.0.0
Operating system and version: Ubuntu 20.04
Apache or nginx version: Apache
PHP version: 8.0

The issue you are facing:
Fresh installed Nextcloud. I cant login. After entering my Credential i just get put back to the login page

Is this the first time you’ve seen this error?: Y

Steps to replicate it:

  1. Go to my nextcloud install (nextcloud.mydomain.net)
  2. Enter Credentials
  3. gets Redirected to nextcloud.mydomain.net/index.php/login?redirect_url=/index.php/apps/dashboard/

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

  GNU nano 4.8                                                      /var/www/nextcloud/config/config.php                                                                 
$CONFIG = array (
  'instanceid' => 'SECRET',
  'passwordsalt' => 'SECRET',
  'secret' => 'SECRET',
  'trusted_domains' => 
  array (
    0 => '',
    1 => 'nextcloud.mydomain.net',
  'datadirectory' => '/mnt/nextcloud',
  'loglevel' => 0,
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'dbtype' => 'pgsql',
  'version' => '',
  'overwrite.cli.url' => 'http://nextcloud.mydomain.net',
  'overwritehost' => 'nextcloud.mydomain.net',
  'overwriteprotocol' => 'http',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'SECRET',
  'installed' => true,

The output of your Apache/nginx/system log in /var/log/____:
access.log - - [14/Jan/2022:14:03:33 +0100] "GET / HTTP/1.1" 302 1061 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36" - - [14/Jan/2022:14:03:34 +0100] "GET /index.php/login HTTP/1.1" 200 7114 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36" - - [14/Jan/2022:14:03:38 +0100] "POST /index.php/login HTTP/1.1" 303 918 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36" - - [14/Jan/2022:14:03:38 +0100] "GET /index.php/apps/dashboard/ HTTP/1.1" 303 915 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36" - - [14/Jan/2022:14:03:38 +0100] "GET /index.php/login?redirect_url=/index.php/apps/dashboard/ HTTP/1.1" 200 7143 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"


[Fri Jan 14 14:03:08.429481 2022] [http2:warn] [pid 181] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[Fri Jan 14 14:03:08.460265 2022] [mpm_prefork:notice] [pid 181] AH00163: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Fri Jan 14 14:03:08.460308 2022] [core:notice] [pid 181] AH00094: Command line: '/usr/sbin/apache2'


{"reqId":"dpNmZMTASuYBSUAOHNEW","level":0,"time":"2022-01-14T13:03:38+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"GET","url":"/index.php/apps/dashboard/","message":"Current user is not logged in","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36","version":"","exception":{"Exception":"OC\\AppFramework\\Middleware\\Security\\Exceptions\\NotLoggedInException","Message":"Current user is not logged in","Code":401,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php","line":97,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\Security\\SecurityMiddleware","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php","Line":153,"CustomMessage":"Current user is not logged in"}}

Network tools:

I think this is your problem:

The mpm module (prefork.c) is not supported by mod_http2

What I can say is that Apache is not configured correctly or missing a dependency for http2?

I searched and found this discussion:


Thats about all I can add on this. Perhaps others?

Hi @gigagames

You need to switch from mod-php to php-fpm in order for http2 to work.

Install PHP-FPM and disable mpm-prefork:

apt install php8.0-fpm
a2dismod php8.0 && a2dismod mpm_prefork
a2enmod proxy_fcgi setenvif mpm_event
systemctl restart apache2
a2enconf php8.0-fpm
systemctl restart apache2 && systemctl restart php8.0-fpm

Note, tthat PHP and PHP-FPM have independent configuration files. Any changes to the PHP configuration must be made again under /etc/php/8.0/fpm/.

Enable HTTP/2

Enable the HTTP2 Apache module and restart all relevant services:

a2enmod http2 && systemctl restart php8.0-fpm && systemctl restart apache2

Create the http2.conf file…

nano /etc/apache2/conf-available/http2.conf

…and paste in the following:

<IfModule http2_module>
Protocols h2 h2c http/1.1
H2Direct on
H2StreamMaxMemSize 5120000000

Hope that helps…

1 Like

I fixed the HTTP2 error (ignored it becouse it says it will Disable / resuming normal operations) so i fixed it. Nothing changed (except that the error.log is now empty)

Reinstalled, same Problem.

I “fixed” it by adding a self signed-certificate and moved over to Https.
Now i can login. But ONLY if im on the https page if i try http again i just got the loop.

According to the Apache docs most modern browsers support HTTP/2 only over SSL connections…


So I would recommend to set a redirect to HTTPS in your Nextcloud VirtualHost:


Same problem here. How did you solve it? I’m running it in a docker behind a reverse proxy.

@bb77 thanks for the link. But on the first install http/2 was not working (error.log).

@mashiro for now i just fixed it by adding a HTTP to HTTPS redirect and added a self-signed certificate. As suggested by bb77 you also could try to disable HTTP/2 if you have this module enabled