Forum Moderators: phranque

Message Too Old, No Replies

How to restrict access to 2 specific ip addresses

         

stelaras11

10:08 am on Jan 31, 2006 (gmt 0)

10+ Year Member



I am trying to modify the httpd.conf file in order to be able to let anyone in my site (url) and restrict access only to 2 specific ip addresses..

Here is the configuration i am testing:

<Directory /www/htdocs/>
Order Deny,Allow
Deny from 10.99.99.99
Deny from 10.99.99.100
</Directory>

Can you please help me to solve the aforementioned issue?

Thanks in advance

coopster

1:12 pm on Jan 31, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, stelaras11.

You haven't stated what your problem is although I believe I know. Have you read the Apache mod_access [httpd.apache.org] documentation? The manual pages are usually the best place to start and you'll find them invaluable soon. Pay particular attention to the directives you are using and the order you are using them. I think you'll see the issue right away.

stelaras11

8:12 am on Feb 2, 2006 (gmt 0)

10+ Year Member



Dear coopster,

thank you very much for your reply
I 've read multiple time the pages you mention.
I believe that i have understand the logic of deny-allow and my configuration is correct.

I expect to allow access only to 2 ips and permit access to anyone else but the result is not the expected...

Is there a syntax problem in my configuration?

thank you

coopster

3:45 pm on Feb 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




I expect to allow access only to 2 ips and permit access to anyone else ...

So you want everybody to be able to access? Why even use the directive then?

stelaras11

8:46 am on Feb 3, 2006 (gmt 0)

10+ Year Member



sorry for the misunderstanding

the target is to restrict access to these 2 specific ips and allow access to everyone else..

coopster

6:51 pm on Feb 3, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Well then I would expect that container to work as you expect.

The absence of an accompanying

Allow
directive means that the default access state is to allow access (access is allowed by default when the
Order
is
Deny,Allow
). However, any requests from the two ip addresses specified in the Deny directives would be denied access.

You said that these updates were made in your httpd.conf file. You have to restart the Apache server every time you make changes to this file. If you have not yet restarted the server you must do so. Also, make sure you don't have any per-directory override files (.htaccess) in the path to the directory you are testing access to as they will override this httpd.conf setting.