Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have a subdomain I'd like to only be accessible by a local IP address. Is it possible to specify this in the vhost? I'm thinking it's not since I haven't found much on Google. If not, what's the best way to do this on an apache level? I forget the version of Linux we're using... but we have Samba running on it.

The site I'm trying to restrict is our site's documentation.

share|improve this question
up vote 5 down vote accepted

Default Apache VirtualHost configuration has alias for /doc/ that redirects to Apache's documentation and access is restricted only to localhost. I think that is what you are looking for. Look at the Deny and Allow lines.

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from ::1/128
share|improve this answer

You can definetly disable access to a directory based on IP with mod_access (included in most linux distributions):


<Directory /docroot>
 Order Deny,Allow
 Deny from all
 Allow from 

If you block the access to the whole document root for that vhost then the user from outside should not get more than 403 Forbidden all the time.

share|improve this answer

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.