This is how you can configure Railo Express to use Jetty virtual hosts and local host file entries to point to a single Railo Express installation. This was extremely useful while developing applications that power multiple domains.
For this example, we are going to add a virtual host for the snow.ftd
host.
Jetty Setup
Jetty makes it really easy to configure virtual hosts for a context.
The configuration file in Railo Express at {railo-express-directory}/contexts/railo.xml
already has the configuration setup to start us off:
<!-- virtual hosts
<Set name="virtualHosts">
<Array type="String">
<Item>www.myVirtualDomain.com</Item>
<Item>localhost</Item>
<Item>127.0.0.1</Item>
</Array>
</Set>
-->
Uncomment the block of code and change the item to match the snow.ftd
host name like so:
<!-- virtual hosts -->
<Set name="virtualHosts">
<Array type="String">
<Item>snow.ftd</Item>
</Array>
</Set>
Local Host Setup
I already posted instructions for adding local hosts to your Snow Leopard. You can follow the directions there to setup your desired host. In linux you can modify your hosts file in a similar fashion. There may even be a way to change your hosts file on windows, although I have never done so.
Testing
Once the Jetty config and the local hosts have been updated, restart Railo—if it is running—and go to snow.ftd:8888
in your browser. You should see the same page available at localhost:8888
.
And you are done! You can now add as many hosts as you need!