[Cialug] Virtual hosts in Apache

Tim Wilson tim_linux at wilson-home.com
Fri Jun 1 12:26:24 CDT 2007


It's not quite working, maybe what I want is a little more complicated.
Here's what I have:
Listen 80
Listen 8080
<VirtualHost 127.0.0.1:80>
  ServerName foo.domain1.com
  DocumentRoot /var/www/html/foo
</VirtualHost>
<VirtualHost 127.0.0.1:80>
  ServerName foo.domain2.com
  DocumentRoot /var/www/html/foo
</VirtualHost>
<VirtualHost 127.0.0.1:80>
  ServerName bar.domain1.com
  DocumentRoot /var/www/html/bar
</VirtualHost>
<VirtualHost 127.0.0.1:80>
  ServerName bar.domain2.com
  DocumentRoot /var/www/html/bar
</VirtualHost>
<VirtualHost 127.0.0.01:8080>
  ServerName foobar.domain1.com
  ServerAlias isphostname.com
  DocumentRoot /var/www/html
</VirtualHost>

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cialug.org/pipermail/cialug/attachments/20070601/45c7739c/attachment.htm


More information about the Cialug mailing list