Sunday, March 21, 2010

Configuring Apache to restrict access from specific IP addresses

* Directions for Apache2 on Mac OS x

If you are hosting Web DAV server or Website using Apache, you might want to do the following if you need to restrict access to only certain ip addresses.

Open a "Terminal" window and navigate to /etc/apache2/httpd.conf

Open this configuration file with your favorite editor (vi, pico) and navigate to the section that lists out the directory your webserver is running under.

.
.
#Controls who can get access to your server
Order allow, deny
#Allow from all
Allow from 192.168.1
Allow from 127
Allow from 208.45.66


You will want to comment out the "Allow from all" line and add the lines below that, replacing the ip's with the ip addresses you wish to gain access.  For example if you type 192.168.1 you are saying to allow any ip address from 192.168.1, for example an ip adress that is on your local network that is 192.168.1.103  or 192.168.1.130.

Hopefully this helps.

No comments:

Post a Comment