nginx+tomcat---apache+tomcat

nginx+tomcat

... 
upstream backends { 
server 192.168.10.11:8080; 
server 192.168.10.12:8080; 
server { 
... 
location / { 
root html; 
index index.html index.jsp; 
location \.jsp$ { 
proxy_pass http://backends;
... 
...
两台机器:
nginx:反向代理
tomcat:JSP(默认网页)
1、通过代理访问,如果是以 .jsp结尾的,交给tomcat处理
2、tomcat记录客户端的真实IP

apache+tomcat

apache整合tomcat 
为什么要整合apache 与 tomcat? 
1. 提升对静态文件的处理性能 
2. 利用Web服务器来做负载均衡以及容错 
3. 无缝的升级应用程序  
JK 
tomcat1: 192.168.10.12 
tomcat2: 192.168.10.13 
apache: 192.168.10.11
apache:

# yum install httpd httpd-devel -y
# tar xf tomcat-connectors-1.2.42-src.tar.gz
# cd tomcat-connectors-1.2.42-src/native/
# ./configure --with-apxs
# make && make install
# cd ../conf
# cp httpd-jk.conf /etc/httpd/conf.d/
# cp uriworkermap.properties workers.properties /etc/httpd/conf
# vim /etc/httpd/conf.d/httpd-jk.conf
JkWorkersFile conf/workers.properties #定义线程的文件JkMountFile conf/uriworkermap.properties #定义uri和线程的映射关系的文件
# sed -r '/^#|^!|^$/d' /etc/httpd/conf/uriworkermap.properties/*.jsp=balancer #jsp网页由哪个线程处理
/jk-manager=jk-manager
/jk-status=jk-status
# sed -r '/^#|^!|^$/d' /etc/httpd/conf/workers.properties
worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true
worker.list=jk-manager
worker.jk-manager.type=status
worker.list=balancer
worker.balancer.type=lb
worker.balancer.error_escalation_time=0
worker.balancer.max_reply_timeouts=10
worker.balancer.balance_workers=node1,node2
worker.node1.reference=worker.template
worker.node1.host=192.168.10.12
worker.node1.port=8009
worker.node1.lbfactor=1
worker.node1.activation=A
worker.node2.reference=worker.template
worker.node2.host=192.168.10.13
worker.node2.port=8009
worker.node2.lbfactor=1
worker.node2.activation=A
worker.template.type=ajp13
worker.template.socket_connect_timeout=5000
worker.template.socket_keepalive=true
worker.template.ping_mode=A
worker.template.ping_timeout=10000
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=600
worker.template.reply_timeout=300000
worker.template.recovery_options=3
# systemctl restart httpd

posted @ 2020-10-20 23:00  梦里花落知多少sl  阅读(213)  评论(0编辑  收藏  举报