Block access by country ip (on virtual host) SOLVED

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

Block access by country ip (on virtual host) SOLVED

Postby ninostar » 10. November 2008 19:28

Hello,

I have two domains and I'm using virtual host configuration file. I would like to block certain countries. Currently I use configuration below, as I want to block only one web site... however this blocks my both web sites?!

How can I enable blocking on only one web site?!

Code: Select all
<VirtualHost *:80>
   DocumentRoot /www/mydomain1.com
   ServerName mydomain1.com
   ServerAlias www.mydomain1.com
</VirtualHost>

<Directory "C:/www">
   Order allow,deny
   allow from all

</Directory>

###

<VirtualHost *:80>
   DocumentRoot /www/mydomain2.com
   ServerName mydomain2.com
   ServerAlias www.mydomain2.com
</VirtualHost>

<Directory "C:/www">
   Order allow,deny
   allow from all

deny from xx.xx.xxx.xxx
deny from xxx.xxx.xxx.xxx

</Directory>
Last edited by ninostar on 10. November 2008 20:38, edited 1 time in total.
ninostar
 
Posts: 10
Joined: 17. July 2008 13:14

Postby Wiedmann » 10. November 2008 19:34

Currently I use configuration below, as I want to block only one web site... however this blocks my both web sites?!

Make your configuration inside the VirtualHost block.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby ninostar » 10. November 2008 19:53

I use this configuration in file httpd-vhosts.conf... did you mean this file?!
ninostar
 
Posts: 10
Joined: 17. July 2008 13:14

Postby Wiedmann » 10. November 2008 19:57

Code: Select all
<VirtualHost *:80>
...
</VirtualHost>

That's a VirtualHost block. And I mean inside such a block.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby ninostar » 10. November 2008 20:23

Now, the apache service doesn't starts??? See the changed code below... did I do something wrong?

<VirtualHost *:80>
DocumentRoot /www/mydomain2.com
ServerName mydomain2.com
ServerAlias www.mydomain2.com

deny from xx.xx.xxx.xxx
deny from xxx.xxx.xxx.xxx

</VirtualHost>

<Directory "C:/www">
Order allow,deny
allow from all
</Directory>
ninostar
 
Posts: 10
Joined: 17. July 2008 13:14

Postby glitzi85 » 10. November 2008 20:28

You forgot Order allow,deny!

Code: Select all
<Directory "C:/www">
   Order allow,deny
   allow from all
</Directory>

<VirtualHost *:80>
   DocumentRoot /www/mydomain1.com
   ServerName mydomain1.com
   ServerAlias www.mydomain1.com
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot /www/mydomain2.com
   ServerName mydomain2.com
   ServerAlias www.mydomain2.com
   Order allow,deny
   allow from all
   deny from xx.xx.xxx.xxx
   deny from xxx.xxx.xxx.xxx
</VirtualHost>
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Postby glitzi85 » 10. November 2008 20:31

Sorry, Order is not allowed in VirtualHosts-Block, try this:

Code: Select all
<Directory "C:/www">
   Order allow,deny
   allow from all
</Directory>

<VirtualHost *:80>
   DocumentRoot /www/mydomain1.com
   ServerName mydomain1.com
   ServerAlias www.mydomain1.com
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot /www/mydomain2.com
   ServerName mydomain2.com
   ServerAlias www.mydomain2.com
</VirtualHost>

<Directory "C:/www/mydomain2.com">
   Order allow,deny
   allow from all
   deny from xx.xx.xxx.xxx
   deny from xxx.xxx.xxx.xxx
</Directory>


glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Postby ninostar » 10. November 2008 20:38

Thanks... this works like a charm :)
ninostar
 
Posts: 10
Joined: 17. July 2008 13:14


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 79 guests