Denying Access to Specific IP Addresses


<Directory /usr/local/apache2/htdocs/private>     Order Deny,Allow    Deny from 192.168.0.2 192.168.0.5 </Directory>


Conversely to what was explained in the previous section, it is possible to allow general access but deny access when the request comes from a specific IP address or range of IP addresses. This is useful, for example, to block specific machines or web crawlers that have been a source of problems or bandwidth abuse.

This example will allow access to the directory /usr/local/apache2/htdocs/private and its subdirectories to anybody except clients with the IP addresses 192.168.0.2 and 192.168.0.5.

Allow and Deny can also restrict access based on the presence of an environment variable, as explained in the "Restricting Access Based on the Browser Type" section, later in this chapter.

Chapter 9 deals with additional ways of restricting or slowing down access to misbehaving clients.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net