Login loop with NextCloud12 Fresh install

Hey Forum,

I have a CentOS 7 server with NginX, PHP-FPM and MySQL installed. Iā€™ve set everything up as it should be, even used the nextcloud generated php config in /etc/php-fpm.d/nextcloud.conf

Howverr Iā€™m in an infinite login loop and canā€™t login to the server. Every login just redirects me back to the login page. In the nextcloud.log file I can see similar lines to this all the way:

{"reqId":"9mlqx7kzDZ3IJv2oocy4","level":3,"time":"2017-09-19T14:33:10+00:00","remoteAddr":"10.0.0.21","user":"--","app":"lib","method":"GET","url":"\/login?redirect_url=\/apps\/files\/","message":"ResourceLocator can not find a web root (root: \/var\/www\/hu.mycompany.cloud, file: core\/vendor\/jquery-ui\/themes\/base\/jquery-ui.css, webRoot: , throw: false)","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/59.0.3071.109 Safari\/537.36","version":"13.0.0.3"}
{"reqId":"9mlqx7kzDZ3IJv2oocy4","level":3,"time":"2017-09-19T14:33:10+00:00","remoteAddr":"10.0.0.21","user":"--","app":"lib","method":"GET","url":"\/login?redirect_url=\/apps\/files\/","message":"ResourceLocator can not find a web root (root: \/var\/www\/hu.mycompany.cloud, file: core\/css\/jquery.ocdialog.css, webRoot: , throw: false)","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/59.0.3071.109 Safari\/537.36","version":"13.0.0.3"}
{"reqId":"9mlqx7kzDZ3IJv2oocy4","level":3,"time":"2017-09-19T14:33:10+00:00","remoteAddr":"10.0.0.21","user":"--","app":"lib","method":"GET","url":"\/login?redirect_url=\/apps\/files\/","message":"ResourceLocator can not find a web root (root: \/var\/www\/hu.mycompany.cloud, file: core\/css\/guest.css, webRoot: , throw: false)","userAgent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/59.0.3071.109 Safari\/537.36","version":"13.0.0.3"}

Any idea?

1 Like

Did you check the given paths if the files are present?

@tflidd

Yes, OFC. The files do exist, it is a fresh installation of NextCloud. Everything is at itā€™s place. I have no clue what is this error message is. Also, in addition, here is my config.php

 <?php
$CONFIG = array (
  'instanceid' => 'SECRET',
  'passwordsalt' => 'SECRET',
  'secret' => 'SECRET',
  'trusted_domains' =>
  array (
    0 => 'cloud.mycompany.hu',
  ),
  'datadirectory' => '/var/www/hu.mycompany.cloud/data',
  'overwrite.cli.url' => 'https://cloud.mycompany.hu',
  'dbtype' => 'mysql',
  'version' => '13.0.0.3',
  'dbname' => 'SECRET',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'SECRET',
  'dbpassword' => 'SECRET',
  'allow_user_to_change_display_name' => true,
  'session_lifetime' => 28800,
  'token_auth_enforced' => false,
  'mail_domain' => 'mycompany.hu',
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'php',
  'htaccess.RewriteBase' => '/',
  'overwritewebroot' => '',
  'maintenance' => false,
  'installed' => true,
);

If I remove 'htaccess.RewriteBase' => '/', and 'overwritewebroot' => '', nothing changes.

Please use the release packages on https://nextcloud.com/changelog and donā€™t use the development version from github (does not work straight away).

Ok, Iā€™ve downloaded the 12th version and unpacked it. However, the exact same happens.

  • I manage to install it via the 1st config screen
  • Iā€™m automatically logged in, but canā€™t do anything
  • After 10 sec, Iā€™m automatically logged out
  • Login loop again

Grrrrrā€¦ And now not even the nextcloud.log file logs anythingā€¦ What gives?

AAAAAAAAND solved!

File permissions in /var/lib/php/ are all wrong if you are using NginX.

chown nginx:nginx /var/lib/php/session/
chown root:nginx /var/lib/php/wsdlcache/
chown root:nginx /var/lib/php/opcache/

And all works. Please @system , write this in the installation manual regarding to NginX because Iā€™ve literally teared out all my hair until Iā€™ve found this.

3 Likes

Thanks Imre_Bertalan,

I followed what you suggested and chowned those folders except I am using PHP7 and so the paths were slightly different:

chown nginx:nginx /var/lib/php/fpm/session/
chown root:nginx /var/lib/php/fpm/wsdlcache/
chown root:nginx /var/lib/php/fpm/opcache/

But I was still seeing the same errors in the log, I then chowned the parent folder as such:

chown -R nginx:nginx /var/lib/php/fpm/

And I was then finally able to login.

Thank you man!
Almost the same issue, but I had no folder /var/lib/php/session (stupid typo in sessions wordā€¦)

TIP: first! check the /etc/php-fpm.d/www.conf file for ā€˜pathā€™ parameters, like
php_value[session.save_path]
php_value[soap.wsdl_cache_dir]

And create appropriate folders (if needed) with ā€˜nginxā€™ user permissions.

Thank U. I registered this account just wanna say thanks to you, it has plagued me for a month, but you do it!

Hi,
I have also created an account to say THANK YOU for the solution.
)))))))))))

How to fix this in case of lighttpd?
No redirect problem from desktop browser but only that lousy app gets stuck on ā€œRedirectingā€. Worked fine in previous version of app. Morons must have changed something.

GET /index.php/login/flow/redirect?clientIdentifier=&ā€¦
ā€¦
GET /core/js/login/redirect.js?v
ā€¦
and then:
POST /index.php/login/flow HTTP/1.1" 303 0