-
2004年10月18日
以代理的方式集成Apache和Tomcat
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://fireshort.blogbus.com/logs/448326.html
这种集成方式比起以mod_jk2集成的方式简单得多,也比较稳定;缺点是全部页面都交给tomcat处理了,性能会差。
以下文字摘自tomcat的文档,以备忘,方便查找。
- Configure your copy of Apache so that it includes the
mod_proxymodule. If you are building from source, the easiest way to do this is to include the--enable-module=proxydirective on the./configurecommand line. - If not already added for you, make sure that you are loading the
mod_proxymodule at Apache startup time, by using the following directives in yourhttpd.conffile:



LoadModule proxy_module {path-to-modules}/mod_proxy.so AddModule mod_proxy.c



- Include two directives in your
httpd.conffile for each web application that you wish to forward to Tomcat 5. For example, to forward an application at context path/myapp:which tells Apache to forward URLs of the form



ProxyPass /myapp http://localhost:8081/myapp ProxyPassReverse /myapp http://localhost:8081/myapp




http://localhost/myapp/*to the Tomcat 5 connector listening on port 8081. - Configure your copy of Tomcat 5 to include a special
<Connector>element, with appropriate proxy settings, for example:which will cause servlets inside this web application to think that all proxied requests were directed to



<Connector port="8081" ... proxyName="www.mycompany.com" proxyPort="80"/>



www.mycompany.comon port 80. - It is legal to omit the
proxyNameattribute from the<Connector>element. If you do so, the value returned byrequest.getServerName()will by the host name on which Tomcat is running. In the example above, it would belocalhost. - If you also have a
<Connector>listening on port 8080 (nested within the same Service element), the requests to either port will share the same set of virtual hosts and web applications. - You might wish to use the IP filtering features of your operating system to restrict connections to port 8081 (in this example) to be allowed only from the server that is running Apache.
- Alternatively, you can set up a series of web applications that are only available via proxying, as follows:
- When requests are proxied by Apache, the web server will be recording these requests in its access log. Therefore, you will generally want to disable any access logging performed by Tomcat itself.
随机文章:
blogbus改版了 2005年01月28日成长中必须知道的20个故事(zt) 2004年11月18日Google Desktop Search,个人知识管理的好东东 2004年10月15日申请了美味书签 2004年10月13日还有人要gmail的邀请吗 2004年09月11日
收藏到:Del.icio.us
引用地址: - Configure your copy of Apache so that it includes the





