Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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
up vote 4 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

For example, this will allow only the subnet 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

Your Answer


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.