HomeDocumentation > Configuring and administering > Configuring and administering the Apache Geronimo Server > Configuring the Web Container > Configuring virtual host > Configuring Virtual Host in Jetty

The Configuring Virtual Host in Tomcat topic introduces how to define a Virtual Host in the Geronimo's config.xml file so that applications can be deployed to specific hosts ( Virtual Hosts) with a minimal configuration on the application deployment plans side. However, the need to define Virtual Hosts at the server level ( config.xml ) only applies to Geronimo with Tomcat distributions.

For the Jetty distribution of Apache Geronimo, configuring Virtual Host is dramatically simpler. You just need to define the <virtual-host> tag in the application's deployment plan and make sure that the host name ( virtual host ) can be resolved by the client. There is virtually no additional configuration needed on the Geronimo server side.

In this topic, the HelloWorld Web sample application, covered in the Quick start - Apache Geronimo for the impatient section, is used as an example. You can use the following steps to create the HelloWorld application and define a virtual host in Geronimo with Jetty:

  1. Create a app_home directory somewhere in the file system, from now on we will reference this location as <app_home>.
  2. Create a HelloWorld.jsp file in the <app_home> directory and paste the following content to the file.
    HelloWorld.jsp
  3. Create a WEB-INF directory under <app_home>.
  4. Create a web.xml file in the <app_home>\WEB-INF directory and paste the following content to the file.
    web.xml
  5. Create a geronimo-web.xml file in the <app_home>\WEB-INF directory and paste the following content to the file.
    geronimo-web.xml

    If you compare this deployment plan with the one described in the Quick start - Apache Geronimo for the impatient section, you will notice that only one line has been added, that is <virtual-host>virtualhost1.com</virtual-host>.

This is all you need to define a virtual host in Geronimo with Jetty.

To deploy this application, you can use the --inPlace option from the deployer tool so that you do not need to package the application nor copy it anywhere else. Run the following command:

The following information will be displayed in your command window:

D:\geronimo-jetty6-jee5-2.1\bin>deploy --user system --password manager deploy --inPlace \HelloWorld_2.1
Using GERONIMO_BASE:   D:\geronimo-jetty6-jee5-2.1
Using GERONIMO_HOME:   D:\geronimo-jetty6-jee5-2.1
Using GERONIMO_TMPDIR: D:\geronimo-jetty6-jee5-2.1\var\temp
Using JRE_HOME:        C:\Java\jdk1.5.0_06\\jre
    Deployed sample.applications/HelloWorldApp/2.1/war @
    http://hcunico:8080/hello

Note that even when the successful deployment message on screen shows that the application has been deployed to the http://XYZ:8080/hello host, the application will only be accessible via the virtual host previously defined in the <virtual-host> tag on the geronimo-web.xml deployment plan.