I have 3 wars set up on a Tomcat instance - these wars are being served at:
I have Apache on the same machine. I am trying to set Apache up so that I can access the 3 wars in the following way:
- http://war1.mycompany.com:9024/ [yes, port 9024]
- http://war2.mycompany.com:9024/
- http://war3.mycompany.com:9024/
I have tried following the example Using Virtual_Host and mod_proxy together, but it is not working correctly. When I visit http://war1.mycompany.com/ the browser gets sent a 302
towards http://war1.mycompany.com/war1/ and that in return gives a 400
error.
If I visit http://war1.mycompany.com:9023/war1 (ie query Tomcat directly) then I get the site I am expecting, so the DNS is set up correctly, and the war is correctly deployed.
My Apache configuration file (/etc/httpd/conf.d/sites.conf
) is as follows:
Listen 9024
<VirtualHost *:9024>
ServerAdmin admin@mycompany.com
ServerName war1.mycompany.com
ErrorLog logs/error_log
CustomLog logs/access_log common
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:9023/war1
ProxyPassReverse / http://127.0.0.1:9023/war1
</VirtualHost>
I am using Apache 2.2.3 and Tomcat 6.0.14. Tomcat is configured pretty much normally:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
</Host>
The wars are in CATALINA_HOME/webapps/war1.war
, etc.
What am I doing wrong? Is there something I should be looking for in the main Apache configuration?