Apache + Tomcat + Struts 2 configuration
I would like to configure my website to work partly with Apache and partly with Tomcat. Let me explain. When the user navigates onto my domain (lets call my domain as "abc").. so abc.com then I would like Apache to serve the index.html开发者_如何学Python page. From there, if he clicks on any static page then Apache should serve that page.
But if he clicks on a dynamic link such as a page where a member needs to log on, then I would Tomcat to take over.
Deployment details:
My tomcat web app has been deployed as ROOT.war. So I can hit my webapp in tomcat by going to abc.com:8080/memberlogonIn my httpd.conf I have a line like the below which right now forwards everything to tomcat.
<Location />
ProxyPass ajp://localhost:8009/
</Location>
How do I forward only struts2 related URLs to tomcat? I use tiles so I dont access any underlying jsp.
Please let me know if I can provide any additional information that can help
Well I'm not sure how mod_proxy handles this, but it can easily be done with mod_jk. My company doesn't use mod proxy because it has some security issues that will not pass PCI compliance tests.
This can be accomplished by setting switches in your httpd.conf file according to what extension you want to have tomcat serve up with mod_jk.
For example, to have tomcat handle jsp files you would have the declaration:
# send all requests ending in .jsp to worker1
JkMount /*.jsp worker1
And to make sure apache is serving up all static or html files something like:
# do not send requests ending with .html to worker1
JkUnMount /*.html worker1
Here are few sites to get your started on the configuration options:
Quick Start HowTo
Apache HowTo
The Apache Tomcat Connector - Reference Guide
How do I connect Apache to Tomcat using the mod_jk module?
精彩评论