views:

485

answers:

1

On my Apache 2.x server at home, I have a number of virtual directories. I've set up my router so that I can access Apache from the internet. I need to keep one of those virtual dirs (/private) from being accessed outside my home network LAN. So given /private, how do I configure Apache to only serve requests to /private from 192.168.4.x?

+1  A: 
<Directory /users/me/private>
    Order deny,allow
    Allow from 192.168.4
    Deny from all
</Directory>
chaos
I tried the following:Alias /private /users/me/private<Directory /private> Order allow,deny Allow from 192.168.4 Deny from all</Directory>I restarted Apache yet I still can access the site via the Internet. I tested it using my smartphone browser running on the Verizon network. ??
Use the actual system pathname to the directory, /users/me/private, in the Directory config, or use a Location instead.
chaos
Using the actual path now give me a '403 Forbidden' error from both outside and inside of my network:You don't have permission to access /private on this server.
Sorry, wrote the Order directive wrong. Should be deny,allow. Edited to fix.
chaos
(I do that sometimes since the semantics of the Order directive are the exact opposite of what they seem to me like they should be.)
chaos
That worked! Thanks.