How do I use Tomcat's non-blocking connectors (NIO or APR) and Apache Httpd together?
I'm building a small web app in Spring so I've been using To开发者_如何学编程mcat as my application server. The web app requires comet connections so I'm using Tomcat's NIO as the connector. However, another part of the app needs to run a php bulletin board. I've done setups where Apache httpd handles all the requests and passes them to Tomcat using mod_jk only when it needs to. Apache handles all the static and php content.
However, it seems Apache httpd cannot be used like this if Tomcat is using NIO or APR to serve comet requests. Is there a way I can have Tomcat handle all requests and pass php requests to Apache which is hanging behind Tomcat? Or is there some other proxy I can use? Any ideas are appreciated. Thanks!
You could route all of your NIO comet connections through port 8080 and bypass apache altogether and then use port 80 apache for your php.
I use Jetty for comet, which is a really good choice for comet as it is a full web server that can stand on its own, so there is no need for Apache.
Another option is to look into the Querces PHP servlet for Java, which may help eliminate Apache while still allowing you to use php.
I hope one of these options, or a combination of them, helps you solve your problem.
精彩评论