There are three different way to connect Tomcat and Apache:
1. JK is a project covering web-servers to Tomcat connectors, whereas mod_jk is the Apache module developed in JK.
IIS webserversupport is implemented on JK, using a redirector called isapi redirector.
Netscape/SunONE/Sun webserverwebserver support is implemented on JK, using a redirector called nsapi redirector.
2. http_proxy is a http proxy using HTTP protocol. It work both with Apache 1 and 2. It is very easy configure than JK, but lost some performance.
3. ajp_proxy comes with Apache 2.2.x, it's works with AJP protocol 1.3. So it gets the same performance as JK(even better) and the same easy configuration as http_proxy.
If you are using IIS, JK is the only solution. But if you are using Apache 2.2.x, ajp_proxy is the best solution. Now let's go with it. Since Tomcat 3.x, 4.x, 5.x and 6.x all support AJP 1.3, ajp_proxy can work well with them.
By default, ajp_proxy comes with Apache 2.2.x, to verify that, please check that there is a “proxy_ajp.conf” in “/etc/httpd/conf.d” folder (this is based on Redhat Linux, for some other linux system such as debain, “proxy_ajp.conf” is in “/etc/apache2/mods-available”).
And make sure there is such a line as below in “/etc/httpd/conf.d/proxy_ajp.conf”.
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
|
Now let's configure Tomcat as below example, adding a virtual host:
<Host name="hello-test.mycompany.com" debug="0"
appBase="/home/www/hello"
unpackWARs="false" autoDeploy="false">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="Hello." suffix=".log"
timestamp="true"/>
<Context path="" docBase="docs" debug="0" reloadable="true"/>
</Host>
|
Now add a virtual host configuration file for Apache, “/etc/httpd/conf.d/vhost_hello.conf” (Suggested that using vhost_ + AppName or Hostname):
<VirtualHost 192.168.1.6:80>
ServerAdmin aelbery@msn.com
ServerName hello-test.mycompany.com
ProxyPass / ajp://hello-test.mycompay.com:8009/
CustomLog /var/log/httpd/Hello.log combined
</VirtualHost>
|
Finally modify “/etc/hosts” or using DNS resolve the new virtual host: (Make sure both the server and clients can resolve correctly. )
192.168.1.6 hello-test.mycompany.com
|
分享到:
相关推荐
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so ``` - 可选地,如果需要监控功能,还可以加入: ```apache LoadModule proxy_balancer_module modules/mod_proxy_balancer.so ``` **2. 虚拟主机配置**...
列表包含 mod_proxy.so mod_proxy_http.so mod_proxy_ajp.so mod_proxy_ftp.so mod_proxy_connect.so mod_proxy_balancer.so
apache服务器和tomcat服务器之间实现URL代理的module.so工具类文件
nginx_ajp_module-通过Nginx支持AJP协议代理 概要 http { upstream tomcats { server 127.0.0.1:8009; keepalive 10; } server { listen 80; location / { ajp_keep_conn on; ajp_pass tomcats; } } } ...
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so ``` 2. `httpd-vhosts.conf`:虚拟主机配置文件,定义了Apache如何处理不同域名或端口的请求。在这里,你可以配置负载均衡规则,比如使用Round Robin策略...
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so 再找到<IfModule dir_module>加上index.jsp修改成 <IfModule dir_module> DirectoryIndex ...
apache服务器和tomcat的连接方法其实有三种:JK、http_proxy和ajp_proxy。本文主要介绍最为常见的JK。 环境:PC2台:pc1(IP 192.168.88.118)安装了apache和tomcat pc2(IP 192.168.88.168)安装了tomcat 系统 win ...
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /app ajp://localhost:8009/app stickysession=JSESSIONID|jsessionid nofailover=On ...
【酒店服务礼仪培训】 酒店服务礼仪是衡量酒店服务质量的重要标准,它涵盖了员工的仪表、仪态、礼节、语言和电话礼仪等多个方面。礼仪源于民俗,逐渐演变为社会交往的行为规范,是个人素质和专业形象的体现。...
mod_proxy_ajp连接方式是通过Apache的mod_proxy_ajp模块与Tomcat服务器进行通讯,mod_proxy_ajp模块可以将请求转发到Tomcat服务器上。mod_proxy_ajp连接方式相比于mod_proxy连接方式更加高效、更加稳定。 在选择...
修改apache配置文件httpd.conf 启用mod_proxy_ajp 代码如下: #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so 把这两行前面的#去掉即可 然后在末尾加上 ...
apache配置反向代理需要的so,配置参考如下: LoadModule proxy_module modules/mod_proxy.so...LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_connect_module modules/mod_proxy_connect.so
JK方式是最常见的方式,http_proxy和ajp_proxy方式也可以实现,但需要使用mod_proxy模块。Apache和Tomcat的集成可以提高系统的整体性能,特别是在大量使用静态页面和图片的情况下。 四、 Apache和Tomcat集群 ...
Tomcat性能调优方案,tomcat集群,tomcat配置 三、Apache集成Tomcat ... 如果一个项目中大量使用了静态页面、大量的图片...Apache和Tomcat的整合有三种方式,分别是JK、http_proxy和ajp_proxy.其中JK方式是最常见的方式
这是一个 Nginx 的模块,用来使用 Ajp 协议连接后端的 Tomcat ,相当于 Apache 上的 mod_jk 模块。 配置方法: upstream tomcats { server 127.0.0.1:8009 srun_id... ajp_pass tomcats; } } 标签:Nginx
White bells with pendulums of aniseHarmonies of glass where my lips become puppetsAnd take me to a gentle river of warm currentWhere I dream with seeing your gaze.But I refuse to open my eyes ...
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so ``` 这些模块是实现Apache与Tomcat整合所必需的。 3. **配置代理传递** 在文件末尾...