...
anchor
To configure a virtual host in Geronimo you basically need to:
...
...
This article used the simple HelloWorld application as a reference, this application is covered in the Quick start - Apache Geronimo for the impatient section.
...
Make sure your system can resolve these names.
Define Virtual host
...
title | Be Careful |
---|
...
Now you need to define those virtual hosts in Geronimo's config.xml
so it can recognize them. This section provides two different virtual hosts definitions, that is creating two new HostGBean (TomcatVirtualHost1 and TomcatVirtualHost2) in the Geronimo configuration, one of those will have multiple host names aliases. The goal of this example is to have an application listening on a single virtual host ( this will be virtualhost1.com ) and another application listening on a different virtual host ( this will be virtualhost2.com ) with two additional aliases ( this will be virtualhost3.com and virtualhost4.com ).
...
To define the first HostGBean TomcatVirtualHost_1
add the following lines right after <module name="org.apache.geronimo.configs/tomcat6/2.1/car">
.
...
...
To add the second HostGBean TomcatVirtualHost_2
add the following lines right after the first HostGBean. These two HostGBeans have been split so it is easier to identify them. The main difference between these two is the <attribute name="aliases">..,..</attribute>
line to define the aliases.
...
...
At this point you have successfully configured two different virtual hosts in Geronimo. Make sure you save the changes to the config.xml
file and start*\ Geronimo.Back to Top
For additional reference, this is an excerpt from config.xml
of the entire <module name="org.apache.geronimo.configs/tomcat6/2.1/car">
entry with the two HostGBean already defined.
...
...
Back to TopNote: Some tags in the config.xml
shown above are presented in multiple lines for displaying purposes only.
Declare the virtual host in the deployment plan
...
Assuming you followed the steps covered in the Quick start - Apache Geronimo for the impatient section you should have the following structure:
...
Open the geronimo-web.xml
file and edit the artifactId
and context-root
to make this deployment unique. Within the web-app
section add the host
attribute and specify the Virtual Host you want this application to listen on, in this case virtualhost1.com
.
...
...
Save the changed to the geronimo-web.xml
file and generate a WAR file by typing the following command from the <app_home> directory:
...
We will now repeat this steps to create a second WAR. Edit once again the geronimo-web.xml
file and copy the content form the following example. Note that we are only changing the artifactId
, context-root
and host
.
...
Save the changed to the geronimo-web.xml
file and generate a second WAR file by typing the following command from the <app_home> directory:
...
You now have two applications ready to be deployed to two different virtual hosts.
Deploy the application
At this point you have configured Geronimo to use two different Virtual Hosts, one of them is also configured to listen under additional aliases. All you need to do now is to deploy the applications and test them. To deploy the applications type the following commands from the <geronimo_home>\bin directory:
...
You should get a successful confirmation message similar to this one:
#000000solid No Format bgColor #000000 borderStyle solid
Repeat the deployment for the second application.
...
You should get a successful confirmation message similar to this one:
No Format
With the applications deployed the only thing left is to test them. Test hello_1 first, try to access the hosts names defined on the Geronimo server machine:
...
Congratulations!!! you have successfully configured and deployed two applications to two different virtual hosts and aliases.Back to Top