Page 1 of 1

403 client denied by server configuration error

PostPosted: 14. October 2012 23:13
by jdorner
Hey there :)
I just upgraded to XAMPP version 1.8.1 on Windows 7

Everything worked fine before upgrading XAMPP.
Now, when I go to a virtual host, I get 403 Access forbidden.
For example, when I go to: http://nacaa.local the error generated is:
Code: Select all
[Sun Oct 14 17:51:46.147763 2012] [authz_core:error] [pid 4120:tid 1708] [client 127.0.0.1:50143] AH01630: client denied by server configuration: C:/xampp/htdocs-nacaa/


I've tried to open .txt files that are in the folder and get the same results.
There is no .htaccess file in that folder.

http://localhost redirects to: http://localhost/xampp/
Everything seems to be working fine there.

My xampp\apache\conf\extra\httpd-vhost.conf file contains:
Code: Select all
 <VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs-nacaa"
    ServerName nacaa.local
    ErrorLog "logs/nacaa.localhost-error.log"
     <Directory "C:\xampp\htdocs-nacaa">
      Options Indexes FollowSymLinks Includes ExecCGI
       Allow from all
       Order allow,deny
     </Directory>
  </VirtualHost>


Like I said, before I upgraded, everything was working.
I get no errors when I start XAMPP or Apache.
I get the same errors for all the virtual hosts.

Any help would be greatly appreciated.
TIA,
John

Re: 403 client denied by server configuration error

PostPosted: 15. October 2012 00:34
by jdorner
After reading http://httpd.apache.org/docs/2.4/upgrading.html#access I replaced the
Code: Select all
Order allow, deny
Allow from all

with:

Code: Select all
  <VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs-nacaa"
    ServerName nacaa.local
    ErrorLog "logs/nacaa.localhost-error.log"
     <Directory "C:\xampp\htdocs-nacaa">
      Options Indexes FollowSymLinks Includes ExecCGI
      AllowOverride All
      Require all granted
     </Directory>
  </VirtualHost>


Restarted Apache and still no luck.

Re: 403 client denied by server configuration error

PostPosted: 15. October 2012 00:49
by jdorner
Problem solved.

In c:\xampp\apache\conf\httpd.conf
change:
Code: Select all
<Directory />
    AllowOverride none
    Require all denied
</Directory>


to:

Code: Select all
<Directory />
    AllowOverride none
    Require all granted
</Directory>


Simple if you know what to do.
Hope this saves someone the hours I've spent today trying to solve this problem.

Re: 403 client denied by server configuration error

PostPosted: 15. October 2012 00:53
by JJ_Tagy
Not sure it matters, but out of curiosity, did you try changing the direction of your slashes?

C:/xampp/htdocs-nacaa

Re: 403 client denied by server configuration error

PostPosted: 15. October 2012 04:33
by Altrea
Hi jdorner,

jdorner wrote:In c:\xampp\apache\conf\httpd.conf
change:
Code: Select all
<Directory />
    AllowOverride none
    Require all denied
</Directory>


to:

Code: Select all
<Directory />
    AllowOverride none
    Require all granted
</Directory>


Don't do that!
and especially don't recommend others to do the same!
It is highly not recommend and a big security hole!


That is the general default setting for permissions which are not setted.
Means, every ressource you haven't configured properly would know be accessible, independend if you want to or not.

jdorner wrote:Simple if you know what to do.

Sorry, but you don't know what to do.

best wishes,
Altrea

Re: 403 client denied by server configuration error

PostPosted: 15. October 2012 13:37
by jdorner
Altrea,

Thank you for your comment - but... if I don't change the "Require all" from "denied" to "granted", could you advise me what to do to make it work properly?

I agree - I do not know what to do.

Thanks,
John

Re: 403 client denied by server configuration error

PostPosted: 15. October 2012 15:47
by Altrea
jdorner wrote:could you advise me what to do to make it work properly?

First you should change back the default grant level to the secure value Require all denied.
Then you should start with JJ_Tagys hint to replace your backslashes (\) with slashes (/).
After that restart your Apache and check again.

Re: 403 client denied by server configuration error

PostPosted: 31. October 2012 00:38
by rcapispisan
changing the slash may not help if it worked before on the same operating system

have you tried going to the apache config file, /apache/conf/httpd.conf
and find the DocumentRoot value, it should tell you the location of the allowed sites

if you need to change that though, you also have to change the value set in <Directory "**"> - its just a few lines below the DocumentRoot

Re: 403 client denied by server configuration error

PostPosted: 17. December 2012 16:05
by costeaalex
Hi,
please consider doing this:

Code: Select all
<VirtualHost *:80>
    DocumentRoot "D:\sites\site1"
    ServerName bjm.loc
    <Directory "D:\sites\site1">
   Options Indexes FollowSymLinks Includes ExecCGI
   AllowOverride All
   Order allow,deny
   Allow from all
   
   #insert this line
   Require all granted
   #end insertion

    </Directory>
</VirtualHost>


This will grant privs for that dir only and keep you safe. That inserted line worked fine for me.

Hope it helps,
Alex.

Re: 403 client denied by server configuration error

PostPosted: 17. December 2012 17:04
by Altrea
Hi Alex,

costeaalex wrote:This will grant privs for that dir only and keep you safe. That inserted line worked fine for me.

Yes, thats a much better approach.

Three little enhancements:
  • If you are using vhosts, you should define a default host too (e.g. for localhost) that points to the XAMPP Administration Page so that you can still use it.
  • I would use forward slashes instead of backslashes in your paths. It is not absolutely neccessary, but Apache comes from the *nix world and it might be a little bit more bullet proof
  • If you use the new syntax Require all granted you can get rid of Order allow,deny and Allow from all to clean your code a little bit up.

best wishes,
Altrea