简体   繁体   English

如何一起使用Tomcat的非阻塞连接器(NIO或APR)和Apache Httpd?

[英]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 Tomcat as my application server. 我正在Spring中构建一个小型Web应用程序,所以我一直在使用Tomcat作为我的应用程序服务器。 The web app requires comet connections so I'm using Tomcat's NIO as the connector. Web应用程序需要彗星连接,所以我使用Tomcat的NIO作为连接器。 However, another part of the app needs to run a php bulletin board. 但是,应用程序的另一部分需要运行php公告板。 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 httpd处理所有请求的设置,并仅在需要时使用mod_jk将它们传递给Tomcat。 Apache handles all the static and php content. Apache处理所有静态和php内容。

However, it seems Apache httpd cannot be used like this if Tomcat is using NIO or APR to serve comet requests. 但是,如果Tomcat使用NIO或APR来提供彗星请求,那么似乎不能像这样使用Apache httpd。 Is there a way I can have Tomcat handle all requests and pass php requests to Apache which is hanging behind Tomcat? 有没有办法让Tomcat处理所有请求并将php请求传递给挂在Tomcat后面的Apache? 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. 您可以通过端口8080路由所有NIO彗星连接并完全绕过apache,然后使用端口80 apache为您的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. 我使用Jetty作为彗星,这对于彗星来说是一个非常好的选择,因为它是一个完全可以独立存在的Web服务器,因此不需要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. 另一个选择是查看用于Java的Querces PHP servlet,这可能有助于消除Apache,同时仍允许您使用php。

I hope one of these options, or a combination of them, helps you solve your problem. 我希望其中一个选项或它们的组合可以帮助您解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM