1

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.

6

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>
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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