# Login loop with NextCloud12 Fresh install

**URL:** <https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185>\
**Category:** ℹ️ Support\
**Tags:** centos, nc12, php, nginx\
**Created:** [September 19, 2017, 2:36pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185 "2017-09-19T14:36:13Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Imre\_Bertalan](https://help.nextcloud.com/user_avatar/help.nextcloud.com/imre_bertalan/32/34623_2.png) [@Imre\_Bertalan](https://help.nextcloud.com/u/Imre_Bertalan)\
**Post date:** [September 19, 2017, 2:36pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/1 "2017-09-19T14:36:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_22734026db12803ebb3e059622ac3534.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [September 19, 2017, 10:09pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/2 "2017-09-19T22:09:30Z")

</div>

> [@Imre\_Bertalan](#):
>
> ResourceLocator can not find a web root

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

---

<div class="post-metadata">

**Author:** ![Imre\_Bertalan](https://help.nextcloud.com/user_avatar/help.nextcloud.com/imre_bertalan/32/34623_2.png) [@Imre\_Bertalan](https://help.nextcloud.com/u/Imre_Bertalan)\
**Post date:** [September 20, 2017, 7:52am UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/3 "2017-09-20T07:52:11Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_22734026db12803ebb3e059622ac3534.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [September 20, 2017, 8:18am UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/4 "2017-09-20T08:18:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Imre\_Bertalan](https://help.nextcloud.com/user_avatar/help.nextcloud.com/imre_bertalan/32/34623_2.png) [@Imre\_Bertalan](https://help.nextcloud.com/u/Imre_Bertalan)\
**Post date:** [September 20, 2017, 9:06am UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/6 "2017-09-20T09:06:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Imre\_Bertalan](https://help.nextcloud.com/user_avatar/help.nextcloud.com/imre_bertalan/32/34623_2.png) [@Imre\_Bertalan](https://help.nextcloud.com/u/Imre_Bertalan)\
**Post date:** [September 20, 2017, 11:29am UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/7 "2017-09-20T11:29:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bobot4258](https://help.nextcloud.com/letter_avatar/bobot4258/32/6_22734026db12803ebb3e059622ac3534.png) [@bobot4258](https://help.nextcloud.com/u/bobot4258)\
**Post date:** [December 26, 2017, 5:22am UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/9 "2017-12-26T05:22:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nickvsh](https://help.nextcloud.com/letter_avatar/nickvsh/32/6_22734026db12803ebb3e059622ac3534.png) [@nickvsh](https://help.nextcloud.com/u/nickvsh)\
**Post date:** [May 23, 2018, 12:34pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/10 "2018-05-23T12:34:30Z")

</div>

Thank you man!  
Almost the same issue, but I had no folder /var/lib/php/session (stupid typo in session **s** 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.

---

<div class="post-metadata">

**Author:** ![Jade\_Vane](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jade_vane/32/11496_2.png) [@Jade\_Vane](https://help.nextcloud.com/u/Jade_Vane)\
**Post date:** [October 24, 2018, 7:55am UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/11 "2018-10-24T07:55:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![masterofbu](https://help.nextcloud.com/letter_avatar/masterofbu/32/6_22734026db12803ebb3e059622ac3534.png) [@masterofbu](https://help.nextcloud.com/u/masterofbu)\
**Post date:** [January 30, 2019, 8:26pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/12 "2019-01-30T20:26:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nc1](https://help.nextcloud.com/letter_avatar/nc1/32/6_22734026db12803ebb3e059622ac3534.png) [@nc1](https://help.nextcloud.com/u/nc1)\
**Post date:** [June 28, 2020, 11:21pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/13 "2020-06-28T23:21:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [September 23, 2024, 4:48pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/14 "2024-09-23T16:48:30Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 9, 2024, 1:34pm UTC](https://help.nextcloud.com/t/login-loop-with-nextcloud12-fresh-install/21185/15 "2024-12-09T13:34:39Z")

</div>


