[TriLUG] SOLVED Re: apache: different DocumentRoot for different IPs

Joseph Mack NA3T jmack at wm7d.net
Sun May 13 12:03:31 EDT 2012


On Sun, 13 May 2012, Matt Flyer wrote:

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

yes. I didn't explicitely say this, but the line

Listen DEFAULT_GW_IP:80

is going to have an IP in there (after sed does its stuff).

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

it doesn't so far.

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

No. They're all explicite IPs.

Hmm. On seeing your hint about <VirtualHost *:80>, I reread 
the relevent part of the httpd.conf file and then hopped to 
the relevent apache page, I find I'm mixing name based and 
IP based configurations. If I do it all by explicite IPs eg

Listen 192.168.2.252:80
<VirtualHost 192.168.2.252>

rather that using an IP for Listen and a name for 
VirtualHost as I was doing, that I get the expected 
different DocumentRoot. The names I use are all internal 
(mack.net) which resolve with my internal nameserver, but I 
keep changing the IPs and not bothering to update the zone 
and rev files. Presumably apache is using the name rather 
than the IP to find DocumentRoot.

Thanks for your help

Joe
-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list