Hey hey.

On Fri, 2008-01-18 at 09:59 +1030, Roger Symonds wrote:
> I currently looking into Apache and am wondering if it can restrict the IP 
> Addresses it accepts incoming requests on, for a particular virtual host.

Apache has an absolutely mind-boggling array of ways to filter requests.

> On the machine are 3 web applications running behind Apache, all using a 
> seperate virtual hosts.
> Two of the virtual hosts need to remain open to the public on their domains.
> The third application is an application that should only be available to 
> specific IP Addresses.
> 
> Is it possible to get a virtual host to only accept requests from a range of 
> specified IP Addresses?

That's covered in the auth howto;
http://httpd.apache.org/docs/2.0/howto/auth.html#whatotherneatstuffcanido

The last example there is pretty much exactly what you want. In
addition, the Allow and Deny directives will take basically any address
specification you can think of -
http://httpd.apache.org/docs/2.0/mod/mod_access.html#allow

You can't put allow and deny directives straight into the VirtualHost
stanza. I usually wrap them in Location tags like:

<VirtualHost foo>
        DocumentRoot /path/to/docroot/
        <Location />
                Order deny,allow
                Deny from all
                Allow from dev.example.com
        </Location>
        Other stuff
</VirtualHost>

Hope that helps,
-- 
Pete

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to