Login loop with NextCloud Fresh install

After at least a week of trying fresh installs over and over again I am now extremely frustrated with Nextcloud. I am using Apache 2.4.18 on Ubuntu Server 16.04, NOT NginX. Every attempt, whether per command line or wizard, has gone apparently smooth, no errors, yet at login it always either loops, or tells me the password is incorrect. The actual password in the MySQL DB cannot be the issue, as far as I can tell. Like I said I have tried many many installations, a few times choosing a different password. Log files, neither apache, nextcloud or syslog, show any errors.

I gone step by step using the Nextcloud installation instructions, and I tried going by these instructions -

Oh, and with every fresh install I completely wiped out the MySQL DB data.

I just tried and got the same results.

Please, somebody provide me with a solution.
Thank you!

If you’re saying your webserver logs are empty, and the Nextcloud log is empty (situated in /path/to/data/) then we’re going to struggle to troubleshoot a little here.

I will say, however, my guide has hundreds of successful installs and might be worth comparing with how you’ve set it up to date. Check it out here.

Hi Jason,
I carefully followed your installation instructions and now have this entry in my apache error log:

[authz_core:error] [pid 3252] [client] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt

The htaccesstest.txt file does not exist, and my nextcloud.log file is still completely empty.

The permissions on the data directory look like this:
drwxr-xr-x 2 www-data www-data 4096 Sep 26 23:29 data/

Have you edited your global apache.conf file?


My current apache conf is:

Alias “/mycloud” “/var/www/nextcloud”

<Directory /var/www/nextcloud/>
Options Indexes FollowSymlinks
AllowOverride All
Require all granted

Dav off

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud

Interesting. @tflidd any idea?

I just closed and restarted my Chromium browser, got the login screen, but this time it’s telling me

my data directory and files are probably accessible from the Internet because the .htaccess does not work.

The really frustrating thing is that I had Nextcloud 11.0.3 installed and working well, but then wanted to upgrade and things went wrong, so I’ve been struggling with this completely fresh install ever since.

I finally managed to login, if you can call it that. I got a large white dialog screen that disappears after a few seconds saying - This content failed to load, so I logged off. I then got the intro screen with this message -

Access forbidden
CSRF check failed

…and I can’t get a login screen/form now.

No forget it! I’m getting the login loop over and over again now. I’m looking for another cloud service.

have you checked on the ownership of/path/to/nextcloud and it’s rights?

Of course, every single time, and here is how it looks -

drwxr-xr-x 15 www-data www-data 4096 Sep 27 12:23 nextcloud/

The actual full path is /var/www/nextcloud

Are these settings not correct?
One of the other things that gets me is that this login loop has occurred since at least version 9.0 as far as I can tell. I’m trying to install 12.0, and I’m not finding any “error” messages in any log files. If it’s an ownership or permissions issue, why aren’t at least the ownership settings set properly when I unzip the zip file?

Another observation is - the URL redirect at login goes from http://www.mydomain.com/mycloud/index.php/login
to http://www.mydomain.com/mycloud/index.php/login?redirect_url=/mycloud/index.php/apps/files/

I assume that is working properly, but the login loop still occurs.

this seems to be ok to me.

i was just trying to put a sophisticated guess. it doesn’t mean that there really is a problem in permission settings.

another thing that just came up to my mind: did you once move your data-directory to a different place? same with database… was it moved once?

Well I’m not too sure if maybe I’m missing something somewhere else, but like I’ve been saying, I’ve been reinstalling completely fresh (clean) EVERY SINGLE TIME. So, that means I’ve been dropping the (nextcloud) database, removing the nextcloud user from the mysql database, completely deleting the nextcloud directory, and and and.

Sorry but I’m really getting beyond frustration here.

it’s completely understood.

usually it doesn’t happen on completely fresh installations. so next question is: where are you trying to install it?

I’m really wondering if it might have something to do with the installation changing the newly created admin user somewhere. Just a thought, because the issue has to do with logging in. Honestly, the installation instructions are not the clearest to follow if you ask me, I think some more of the installation could be better automated.

OK, my domain doc root is here -


I’m unzipping/installing nextcloud here -


But I’ve also installed nextcloud directly under the doc root but still have the same problem, so that I also do not understand -


Regardless of one or the other I always prior to accessing per web browser, I change the ownership on the nextcloud directory structure to www-data:www-data. Permissions I do not bother changing, because as far as I know they are set right especially with the ownership set to www-data:www-data.

Oh, and I have of course the Apache Alias set according the /var/www/nextcloud directory.

i meant: apparently you are installing it anew over and over again to an existing system. or did i get you wrong again?
and so i wanted to get to know where and how it’s hosted…

Please post the complete vhost config.

1 Like

Yes, it is on the same existing system, every time, but like I’m saying, I’m cleaning everything up before each attempt (as far as I can tell anyway). The system is Ubuntu 16.04 LTS

Let me answer Thomas_Stein and maybe/hopefully you can find something there.


in /etc/apache2/sites-enabled/010-mydomain.conf I have -


ServerName mydomain.com
ServerAlias www.mydomain.com
ServerAdmin webmaster@mydomain.com
DocumentRoot /var/www/mydomain

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Include conf-available/nextcloud.conf


In my conf-available/nextcloud.conf I have -

Alias "/mycloud" "/var/www/nextcloud/"

<Directory "/var/www/nextcloud/">
    Options +FollowSymlinks
    AllowOverride All

  <IfModule mod_dav.c>
      Dav off

    SetEnv HOME /var/www/nextcloud
    SetEnv HTTP_HOME /var/www/nextcloud

<Directory "/var/www/nextcloud/data/">
    Options +FollowSymlinks
    Require all granted

My nextcloud.conf file as above is the current config, but I have also tried a couple of other changes, of course without success.

I’ve noticed not all of the Apache directive statements show up in these posts, especially not the closing.