You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Nash, Marty" <Ma...@rfsuny.org> on 2005/11/14 18:22:50 UTC

[users@httpd] Virtual Hosts

I'm trying to setup 2 virtual hosts on the same IP.  Here's what my
configuration looks like: 

Listen myservername:80 
Listen myotherserver:8080 

NameVirtualHost myservername:80 
NameVurtualHost myotherserver:8080 

<VirtualHost myservername:80> 
DocumentRoot /path/to/htdocs
ServerName myservername 
</VirtualHost> 

<VirtualHost myotherserver:8080>
DocumentRoot /path/to/htdocs
ServerName myotherserver
</VirtualHost> 

This is running on a Solaris 8 host. Using lsof, I can see a 'LISTEN'
for both ports. When I open IE and type in the url for 'myotherserver',
I get the page for 'myservername'. The DocumentRoot statement points to
different paths for each.  Any thoughts? 

Thanks... 

Re: [users@httpd] Virtual Hosts

Posted by Davide Bianchi <da...@onlyforfun.net>.
Nash, Marty wrote:
> I'm trying to setup 2 virtual hosts on the same IP.  Here's what my
> configuration looks like:
> 
> Listen myservername:80
> Listen myotherserver:8080

...Why the 8080 port?

> for both ports. When I open IE and type in the url for 'myotherserver',
> I get the page for 'myservername'.


Of course, because your 'otherserver' listen on port 8080 and not 80
(the default one).

> Any thoughts?

Please, read the documentation about Virtual Hosts, is quite clear
and the example configuration DOES work.

In a pinch: get rid of the Listen directives and leave only the
default one, then use

NameVirtualHost *

<VirtualHost *>
	ServerName myservername
	...other directives as required
</VirtualHost>

<VirtualHost *>
	ServerName otherservername
	...other directives as required
</VirtualHost>

Davide

-- 
General Protection Fault!  [ Ignore ]  [ Reboot ]  [ Install Linux ]
   -- From a Slashdot.org post

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org