[Cialug] Virtual hosts in Apache

David Champion dchampion at visionary.com
Fri Jun 1 12:51:09 CDT 2007


Jeffrey C. Ollie wrote:
> On Fri, 2007-06-01 at 12:26 -0500, Tim Wilson wrote:
>> It's not quite working, maybe what I want is a little more
>> complicated.  Here's what I have:
>> [...]
>> Essentially, I'll be hosting both foo and bar on domain1.com (at least
>> for a while) and domain2.com, but foobar will only be on domain1.com,
>> and be on port 8080.  Right now, I'm just testing domain1.com.  If I
>> go to foo.domain1.com (port 80), I get the correct page.  If I go to
>> foobar.domain1.com (port 80), I get what I expected for
>> foo.domain1.com.  If I go to foo.domain1.com:8080, I get what I
>> expected for foobar.domain1.com:8080.  What do I need to do to display
>> an error if foobar.domain1.com (port 80) is entered?  How do I get
>> foobar.domain1.com:8080 to work, but not foo.domain1.com:8080?  And I
>> did get rid of the Port directive. 
> 
> You need the NameVirtualHost directives.  And unless you really need it,
> I'd change all of the IP addresses to "*", that way it'll work no matter
> what IP adresses are assigned to the system.
> 
> Jeff

Maybe that works better now, but I've had problems with NameVirtualHost
and VirutalHost * in the past... which is why I'm specifying the IP.
Doing a search / replace on the IP isn't that hard (at least using joe.
Doing it in vi, well, that's another story).

-dc





More information about the Cialug mailing list