New manual Install NC13 403 Forbidden error

I did a manual install of NC13 on an Ubuntu 16.04 VPS Using Apache and MySql. I have the Vhost for NC pointing to c.mydomain.com. I successfully loaded index.php and had some trouble linking the DB. I came back the next day and now I get a 403 error when I try to load index.php.

Here’s the last few lines of the error log:

[Sun Apr 15 06:59:36.141247 2018] [authz_core:error] [pid 4028] [client xxx.xxx.xx.x] AH01630: client denied by server configuration: /var/www/nextcloud/favicon.ico, referer: http://c.mydomain.com/index.php
[Sun Apr 15 07:04:33.179738 2018] [authz_core:error] [pid 3835] [client xxx.xxx.xx.x] AH01630: client denied by server configuration: /var/www/nextcloud/favicon.ico, referer: http://c.mydomain.com/index.php
[Sun Apr 15 07:04:33.458902 2018] [authz_core:error] [pid 3835] [client xxx.xxx.xx.x] AH01630: client denied by server configuration: /var/www/nextcloud/favicon.ico, referer: http://c.mydomain.com/index.php
[Sun Apr 15 07:04:40.707150 2018] [authz_core:error] [pid 3838] [client xxx.xxx.xx.x] AH01630: client denied by server configuration: /var/www/nextcloud/favicon.ico, referer: http://c.mydomain.com/index.php
[Sun Apr 15 07:04:40.978087 2018] [authz_core:error] [pid 3838] [client xxx.xxx.xx.x] AH01630: client denied by server configuration: /var/www/nextcloud/favicon.ico, referer: http://c.mydomain.com/index.php

Can anyone help?

ETA:

I see now that earlier there was a different error:

cat /var/log/apache2/nextcloud-error_log
[Fri Apr 13 13:59:43.178366 2018] [authz_core:error] [pid 23790] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:00:20.560421 2018] [authz_core:error] [pid 23792] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:01:04.794746 2018] [authz_core:error] [pid 23795] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:02:06.177937 2018] [authz_core:error] [pid 23788] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:02:41.157819 2018] [authz_core:error] [pid 23913] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:07:47.004209 2018] [authz_core:error] [pid 24146] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:07:56.316918 2018] [authz_core:error] [pid 24149] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:08:55.159973 2018] [authz_core:error] [pid 24146] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:55:50.346282 2018] [authz_core:error] [pid 24149] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:58:54.467544 2018] [authz_core:error] [pid 24154] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 14:59:56.375261 2018] [authz_core:error] [pid 24351] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 15:09:26.626123 2018] [authz_core:error] [pid 24154] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 15:16:59.269938 2018] [authz_core:error] [pid 24152] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Fri Apr 13 15:19:48.291541 2018] [authz_core:error] [pid 24149] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Sat Apr 14 17:35:31.514500 2018] [authz_core:error] [pid 24351] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Sat Apr 14 17:38:43.049581 2018] [authz_core:error] [pid 24146] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Sat Apr 14 17:47:45.057205 2018] [authz_core:error] [pid 24149] [clientxxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Sat Apr 14 17:52:11.152173 2018] [authz_core:error] [pid 24355] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/data/htaccesstest.txt
[Sat Apr 14 17:52:38.180667 2018] [authz_core:error] [pid 24359] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/
[Sat Apr 14 17:52:38.513338 2018] [authz_core:error] [pid 24359] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/favicon.ico, referer: http://c.xxxxxxxx.com/
[Sat Apr 14 17:52:41.635539 2018] [authz_core:error] [pid 24359] [client xxx.xxx.xx.xx] AH01630: client denied by server configuration: /var/www/nextcloud/
[Sat Apr 14 17:52:41.913380 2018] [authz_core:error] [pid 24359] [client xxx.xxx.xx.xx1] AH01630: client denied by server configuration: /var/www/nextcloud/favicon.ico, referer: http://c.xxx.xxx.xx.xx.com/
[Sat Apr 14 17:52:43.792391 2018] [authz_core:error] [pid 24359] [client xxx.xxx.xx.xx1] AH01630: client denied by server configuration: /var/www/nextcloud/

Bump
:confused::confused:

Hi,

have a look into your vhost file or post it here (anonymized!)

Best regards,
Michael

Thanks for your reply.

cat /etc/apache2/sites-available/nextcloud.conf

<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/nextcloud
ServerName c.xxxxxxxx.com
ServerAlias www.c.xxxxxxxx.com

Alias /nextcloud “/var/www/nextcloud/”
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All

Dav off

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

ErrorLog /var/log/apache2/nextcloud-error_log
CustomLog /var/log/apache2/nextcloud-access_log common

Hi nbaker,

It seems that you didn’t close the <Directory> and <VirtualHost> opened.
Try adding the two lines at the end :

</Directory>
</VirtualHost>

And restart apache server.


Léo.

That’s weird. I don’t know why it didn’t paste correctly. and </VirtualHost/> are there.

> <VirtualHost *:80>
> ServerAdmin admin@yourdomain.com
> DocumentRoot /var/www/nextcloud
> ServerName c.xxxxxxxx.com
> ServerAlias www.c.xxxxxxxxxx.com
> 
> Alias /nextcloud "/var/www/nextcloud/"
> <Directory /var/www/nextcloud/>
>  Options +FollowSymlinks
>  AllowOverride All
> 
> <IfModule mod_dav.c>
>  Dav off
>  </IfModule>
> 
> SetEnv HOME /var/www/nextcloud
>  SetEnv HTTP_HOME /var/www/nextcloud
> </Directory>
> 
> ErrorLog /var/log/apache2/nextcloud-error_log
> CustomLog /var/log/apache2/nextcloud-access_log common
> </VirtualHost>

Weird indeed :slight_smile:
Try removing the following from your code :
Alias /nextcloud "/var/www/nextcloud/"

Restart apache and try.


Léo.

Thank you Leo.
I commented out

#Alias /nextcloud “/var/www/nextcloud/”

and restarted apache.

Same error, same error in the log.

You probably have apache2.4, so you have to grant the access to the directory.
Below AllowOverride All, put :
Require all granted

Restart, and tell us if the error’s still there.


Léo.

I added

Require all granted

Same error :disappointed:

Removing all the the below, i.e. everything between the Directory tags did the trick and allowed index.php to load. However I suspect that this code is there for a reason.

Not necessarily, I think it depends on your environment.
For example, here is my VirtualHost stating for Nextcloud with Apache :

<VirtualHost *:80>
        ServerName nextcloud.domain.com
        ServerAdmin xx@xx.xx
        DocumentRoot "/usr/local/www/nextcloud"
        <Directory "/usr/local/www/nextcloud/">
                Options -Indexes
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

And it works well !
Try it and tell me.


Léo.

I tried yours Leo and got the same error. I removed lines one by one and discovered that removing

AllowOverride All

resolved the error.

So I went back to my original config and removed that line and it seems to work. What does that line do?

From what I can read at https://httpd.apache.org/docs/2.4/en/mod/core.html#allowoverride :

Description: Types of directives that are allowed in .htaccess files
Syntax: AllowOverride All

[…]

When this directive is set to All , then any directive which has the .htaccess Context is allowed in .htaccess files.

Something in your webserver configuration, or in .htaccess file, must require that statement…
I never experienced that before !


Léo.

Ok. It’s starting to make sense. I must have somehow corrupted the .htaccess because NC gives me this:

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
	- INVALID_HASH
		- .htaccess
		- index.html
	- EXTRA_FILE
		- nextcloud.log

Starting with .htaccess, I have 3:

/var/www/nextcloud/config/.htaccess
/var/www/nextcloud/data/.htaccess
/var/www/nextcloud/.htaccess

Which one is it and how do I fix it?

Hi nbaker,

Regarding the error you described, I would say : /var/www/nextcloud/data/.htaccess, because all the files in the results are files that are in the data directory.


Léo.

I can’t remember exactly but I think you can see the full path by hovering over the filename or in an other log file. Sorry long time ago that I had these corruption issues.

Thank you gorby and MichaelHo!

I just spun up a new VPS a started from the beginning and now it’s all working.

Glad to read that :slight_smile:
Happy clouding,


Léo.

Just for reference: Next time try to let Nextcloud update your .htaccess files to match the current setup: sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess