Apache and Tomcat with Multiple Virtual Hosts 2006-11-28 - By Chris Duesing
Back Hello,
I am trying to add a second web application to my server, and in doing so I have taken the approach of using multiple virtual hosts in both Apache and Tomcat. The configuration I am using is not currently working and I was hoping someone might spot the reason.
Background:
Apache 2.2
Tomcat 5.5.17
2 java webapps running jsp's under tomcat and 1 with static content under apache.
1 webapp requires https/ssl
Subdomains for each app so they can be at the root, rather than having different context paths.
Mod_proxy and mod_rewrite to communicate between apache and tomcat.
Here are what I believe to be the relevant excerpts from the apache httpd.conf and tomcat server.xml files.
Httpd.conf:
...
<VirtualHost xxx.xxx.xx.xx:443>
ServerName example1.ccx.com
...
ProxyPass / http://example1.ccx.com:8443/
</VirtualHost>
...
<VirtualHost xxx.xxx.xx.xx:80>
ServerName example2.ccx.com <http://www.staging.chicagoclimatex.com/>
...
RewriteEngine On
RewriteRule ^(.*)(\.jsp)(.*)$ http://example2.ccx.com:8080/$1$2$3 [P,L]
</VirtualHost>
Server.xml:
...
<Service name="Catalina">
...
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
...
<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
...
<Engine name="Catalina" defaultHost="climateexchange.com">
<Host name="example1.ccx.com" appBase="webapps/example1_ccx_com"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
<Host name="example2.ccx.com" appBase="webapps/example2_ccx_com"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
...
Thanks for the help,
Chris Duesing
Java Developer
Chicago Climate Exchange, Inc.
312 229 5152, direct
312 554 3350, main
312 554 3373, fax
cduesing@(protected)
Visit us at www.chicagoclimateexchange.com
******************************************
This e-mail and any of its attachments may contain proprietary information, which is privileged, confidential, or subject to copyright belonging to the Chicago Climate Exchange, Inc. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete.
|
|