JBoss: Multiple domains pointing to a single webroot (.war)
Further to my post about multiple webroots and domains in a single instance, to have multiple domains point to a single webroot (.war) you need to do the following:
> JBoss:
1.
Edit your jboss-web.xml file
(jboss/server/default/deploy/cf_website1.war/WEB-INF/jboss-web.xml) and
make sure you have a virtual-host node.
<jboss-web>
<context-root>/</context-root>
<virtual-host>cf_website1</virtual-host>
</jboss-web>
2. Edit your server.xml file (jboss/server/default/deploy/jbossweb.sar/server.xml) and make sure you have a host defined. If you don't, add one, if you do, add each url you want to use in using the <Alias> node.
<Host name="cf_website1">
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="cf_website1_access_log." suffix=".log"
pattern="%t %H %m %U %s %q %b %D %I %h" directory="${jboss.server.log.dir}"
resolveHosts="false" />
<Alias>website1.mysites.com</Alias>
<Alias>www.website1.com</Alias>
<Alias>61.235.111.22</Alias>
</Host>
> Apache:
1. Add each url you want to use in using the ServerAlias parameter.
<VirtualHost *:80 >
ServerName website1.mysites.com
ServerAlias www.website1.com
ServerAlias 61.235.111.22
ProxyPass /CFIDE http://127.0.0.1:8090/CFIDE
ProxyPassReverse /CFIDE http://127.0.0.1:8090/CFIDE
ProxyPass /website1 http://127.0.0.1:8090/website1/
ProxyPassReverse /website1 http://127.0.0.1:8090/website1/
ProxyPass / http://127.0.0.1:8090/website1/
ProxyPassReverse / http://127.0.0.1:8090/website1/
ProxyPreserveHost on
</VirtualHost>
> Misc:
1. You will need to restart both Apache and JBoss for these changes to take effect.