[TriLUG] apache: different DocumentRoot for different IPs

Matt Flyer matt at noway2.thruhere.net
Sun May 13 10:43:46 EDT 2012


I can think of two things off hand:

1) Have you tried putting the IP address in the VirtualHost declaration
line to tell Apache that this IP address is associated with this host? 
For example <VirtualHost your gateway IP:80>  I think this is what you
were trying to do with your webcams.mack.net, but I am not sure if that
works or not.

2) Do you have a default host e.g. <VirtualHost *:80> declaration above
this that could be matching before your other host is being checked?


On 05/13/2012 09:34 AM, Joseph Mack NA3T wrote:
> One my routers at home. I have an httpd (apache-2.x) listening on the
> internal IPs. I'd like to have an httpd listening on the external IP
> as well.
>
> The external IP will show webcams, but I want a different
> DocumentRoot, so that people coming in from the outside don't have
> access to my inside stuff.
>
> The DocumentRoot at the top of the httpd.conf is
>
> DocumentRoot /usr/local/etc/httpd/htdocs
>
> I added a para, with a different DocumentRoot listening to the
> external IP, to my httpd.conf like this
>
> Listen DEFAULT_GW_IP:80
> <VirtualHost webcams.mack.net>
>         ServerName webcams.mack.net
>         DocumentRoot /usr/local/etc/httpd/htdocs/webcams
>         ServerAdmin root at dennis.mack.net
>         ErrorLog /var/log/error_log
>         TransferLog /var/log/access_log
> </VirtualHost>
>
> This added para has "/webcams" added at the end of DocumentRoot. I
> expected that when I surf to $DEFAULT_GW_IP to get the new
> DocumentRoot, but I get the DocumentRoot at the top of the httpd.conf
> file.
>
> Looking at apachectl, it doesn't seem that I can have to separate
> httpd.conf files and hence two httpds listening on separate IPs.
>
> Any suggestions on how to get a different DocumentRoot for the httpd
> listening on DEFAULT_GW_IP?
>
> Thanks
> Joe
>




More information about the TriLUG mailing list