Tomcat implements reverse proxy

Source: Internet
Author: User

Construction of experimental Environment:

Web server director:192.168.11.131 (host-only) 192.168.1.114 (bridge) installs Apache

App Server1 rs1:192.168.11.132 (host-only) installs Tomcat

App Server2 rs2:192.168.11.129 (host-only) installs Tomcat

One, using Apache Mod_proxy and Tomcat connection

1. Check if Apache has loaded the required modules

httpd-d Dump_modules|grep Proxy

2. Comment out the DocumentRoot "/var/www/html" in httpd.conf

3. At/etc/httpd/conf.d,vim httpd-proxy.conf

<virtualhost *:>/http://192.168.11.132:8080/rs1/proxypassreverse/ http://192.168.1.114:8080:rs1/<proxy *>#  Require all granted</Proxy> <location/>#   Require all granted</Location></VirtualHost>

Annotations:

Proxyvia off
#用于控制httpd首部是否使用via, default off
Proxyrequests off
#是否开启Apache的正向代理功能, enabling this key must enable the Mod_proxy_http module, and if Proxypass is set, it must be set to OFF
proxypass/http://192.168.11.132:8080/rs1/
#path (/) is a virtual path on the current server, and the URL (http://192.168.11.132:8080) is a URL path to the back-end server.
If path ends with a/end, then the URL must also end with/, and httpd2.1 later supports the backend-to-server connection pooling feature, which can be defined using Key=value. Common key
Min: Connection pool Minimum amount of space to initialize
Max: Maximum capacity of the connection pool
Loadefactor: For load balancing, define the weight of the backend server
Retry: How long it takes to get an error response to the backend to wait for the second to retry, in seconds
Proxypassreverse/http://192.168.1.114:8080/rs1
#在反向代理中必须使用此指令避免重定向报文绕过代理服务器
<proxy *>

#如果小于2.4, remove require all granted this line
Require all granted
</Proxy>
<location/>

#如果小于2.4, remove require all granted this line
Require all granted
</Location>

4. Verify Access http://192.168.1.114

Tomcat implements reverse proxy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.