Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am very new to this area, so please bear with me. :)

Right now I am running an Apache HTTP server on my setup, a very basic configuration. The website hosted on it is accessible from anywhere, and I want to limit the access to a specific IP address range.

I've looked into this and I found that one Apache module called mod_authz_host handles this.

http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html

The problem is, I haven't managed to find documentation that explains well how to actually do the stuff. How do I actually make sure only a certain range of IP addresses can access my site/server?

The machine is running Ubuntu Server 10.10, the web files are stored in /var/www/, the apache2 daemon has its stuff stored in /etc/apache2/ and /usr/lib/apache2/modules/*. Thanks in advance, and sorry if this is a stupid question!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You just need to customise the following part in your apache2 config file: /etc/apache2/sites-enabled/000-default (if you are using the default configuration).

<Directory /var/www/>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride None
   Order allow,deny
   allow from 192.168.0.0/24
</Directory>

For example, this will allow only the subnet 192.168.0.0/24 to access your web server.

share|improve this answer
    
Thanks a lot, it seems to have worked perfectly! –  BeeDog Dec 23 '10 at 14:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.