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

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

2 Answers 2

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 127.0.0.0/255.0.0.0 ::1/128
</Directory>
share|improve this answer

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

i.e.

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

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

 
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.