Hosting multiple sites on the same machine

I am using Sun's Application Server PE 9, and I'm having great trouble hosting multiple domains on the same box. I used the admin console to create 2 Virtual Servers (aaa.com and bbb.com, for example). I also created 2 HTTP Listeners - one for aaa.com and one for bbb.com. However, when I specify that both listeners use port 80, my websites will not work. It's as if the 2 listeners are competing for the traffic. Is there a solid example of how to create these correctly?

Both sites need to listen on port 80, as that's the standard HTTP port.

The documentation that I've read state that there should be no problem doing this with the Virtual Server feature, but there is no concrete example given. Can somebody give a detailed description on how to set up 2 domains on the same box?

Thanks much.

[829 byte] By [LDawg17] at [2007-11-26 9:12:30]
# 1
I'd also like to see greater clarification on doing this.
cod3fr3ak at 2007-7-6 23:34:04 > top of Java-index,Application & Integration Servers,Application Servers...
# 2

I think I have figured it out.

I created 2 Virtual Servers, using my full domain names as the id (for example, www.aaa.com and www.bbb.com, respectively).

I then used the default Sun hostName variable in the Hosts: field.

Hosts: ${com.sun.aas.hostName}

Default Web Module: I just selected the appropriate web application for each Virtual Server. For example, I selected aaa for my www.aaa.com server. I then selected bbb for my www.bbb.com server.

I created only one HTTP Listener, and named it (although it doesn't matter what I named it) http-rrc-listener. The settings I used for the Listener are as follows:

Network Address: 0.0.0.0

Listener Port: 80

Default Virtual Server: I just picked one of my 2 Virtual Servers as the default.

Once my Listener was created (again, I stress that I only used 1 Listener), I went back in to each Virtual Server to make sure that the Listener was listed in the HTTP Listeners: field of each server.

When this work was done, I stopped and restarted my default server, and now both of my web sites are working properly from the same box.

I hope this helps.

LDawg17 at 2007-7-6 23:34:04 > top of Java-index,Application & Integration Servers,Application Servers...
# 3

I have a similar question. I too have trying to host multiple virtual hosts on the same appserver instance. I dont understand however the overall architecture (even after reading the various developer and admin docs). Perhaps I should first explain what I am trying to do.

I have an collection of webapps that I deploy as an ear to various virtual hosts. Each virtual host is accessed as <customer>.pls.com (e.g., "http://company1.pls.com", "http://company2.pls.com"). Each virtual host has the same four webapps, but each virtual host is configured with company-specific configuration settings. For example, the web.xml files of the webapps for "company1" virtual host connect to a MySQL instance corresponding to that particular company (i.e., each virtual host connects to a different mySQL instance). Given that each virtual host has its own configuration settings, my build process is to build an ear per virtual host with the same webapps but containing different web.xml files for each virtual host containing the customer-specific configuration settings.

Thus my question is: using GlassFish how can I configure different virtual hosts to contain individual instances of the ear webapps, where each instance is configured differently per virtual host?

Steve_Nies at 2007-7-6 23:34:04 > top of Java-index,Application & Integration Servers,Application Servers...
# 4
Thanks a bunch! I finally got mine working fine. The docs online about virtual hosts are not very clear.
pchukwura at 2007-7-6 23:34:04 > top of Java-index,Application & Integration Servers,Application Servers...