VirtualHost entry with ip restrictions causes 403 errors

Problems with the Windows version of XAMPP, questions, comments, and anything related.

VirtualHost entry with ip restrictions causes 403 errors

Postby vmounts » 26. February 2014 15:07

Hi,

I'm an apache newbie so hopefully this is some simple blunder.

Version:
###### ApacheFriends XAMPP Version 1.8.3 ######
xampp-win32-1.8.3-3-VC11-installer
control panel v3.2.1

OS:
Windows Server 2008 R2 - 64bit - Service Pack 1

Install:
C:\xampp
Only installed: Apache, MySQL, php, perl, phpmyadmin, fake sendmail

After initial install:
Everything works fine. localhost takes me to localhost/xampp. I haven't changed anything at the security page there. (I did in a previous install but I uninstalled everything and deleted all folders when I encountered this problem so I could try a bare bones install)
I did add two pages, test1.html and test1.php in c:/xampp/htdocs. Both worked fine.

So I added the following to the very bottom of c:\xampp\apache\conf\httpd.conf, stopped and restarted apache, and changed nothing else.

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
    <Location />
        Order deny,allow
        Deny from all
        Allow from 192.168.1.0/24
        Allow from localhost
        Allow from windevsrv
    </Location>
</VirtualHost>



Now everything I try to reach is a 403 error.

No localhost, no localhost/xampp , neither of my test pages work for example http://localhost/test1.html

The access log shows the denial and appears to sometimes be showing an ip6 address. That's strange because my adapter doesn't have ip6 enabled, and it is the ip6 for localhost anyway. I also have no idea why sometimes it shows up as an ip6 and sometimes a servername when I'm doing the same thing each time.
Edited to add: By the way, windevsrv is just the local host. I added it to the conf file at one point because it was showing up in the access log.

access.log:
Code: Select all
::1 - - [26/Feb/2014:08:08:54 -0500] "GET /test1.php HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36"
::1 - - [26/Feb/2014:08:16:43 -0500] "GET /test1.php HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36"
windevsrv - - [26/Feb/2014:08:19:18 -0500] "GET /test1.html HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36"
::1 - - [26/Feb/2014:08:19:50 -0500] "GET /test1.html HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36"
windevsrv - - [26/Feb/2014:09:00:00 -0500] "GET /test1.html HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36"
windevsrv - - [26/Feb/2014:09:00:35 -0500] "GET /test1.html HTTP/1.1" 403 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36"
vmounts
 
Posts: 3
Joined: 26. February 2014 14:25
Operating System: Windows Server 2008 R2

Re: VirtualHost entry with ip restrictions causes 403 errors

Postby vmounts » 26. February 2014 19:10

I tried switching to the new Require directives with no improvement. I was able to get the same setup working by using a different name than localhost. I guess maybe ServerName can't be localhost for some reason? I could swear I've seen examples where it is the ServerName but not on XAMPP I guess.
vmounts
 
Posts: 3
Joined: 26. February 2014 14:25
Operating System: Windows Server 2008 R2

Re: VirtualHost entry with ip restrictions causes 403 errors

Postby vmounts » 26. February 2014 19:27

Ahhh! I knew it would be something simple." Require local" not require localhost or Allow from localhost.

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
    ServerAlias windevsrv
    <Location />
        Require all denied
        Require local
        Require ip 192.168.1.0/24
     </Location>

</VirtualHost>
vmounts
 
Posts: 3
Joined: 26. February 2014 14:25
Operating System: Windows Server 2008 R2


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 93 guests