Apache reverse proxy

Source: Internet
Author: User

The reverse proxy here is the third connection method http_proxy in Apache HTTP Server and Tomcat introduction. The mod_proxy module of Apache uses proxy technology to connect to Tomcat.

This reverse proxy function means that the user-side browser does not need to change the proxy server to the Apache address here.

Modify D: Program FilesApache Software FoundationApache2.2confhttpd. conf.

1. Remove the comments of the following two rows first

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

2. Then add

ProxyPass/images!
ProxyPass/css!
ProxyPass/js!
ProxyPass/http: // localhost: 8080/, which can also be written:

ProxyPass/oa http: // localhost: 8080/oa
ProxyPassReverse/oa http: // localhost: 8080/oa

You can also add the above two lines consecutively, that is, Start Multiple tomcat

ProxyPass/meb http: // 192.168.6.103: 8081/meb
ProxyPassReverse/meb http: // 192.168.6.103: 8081/meb

......

If the ProxyPassReverse line is not added when ProxyPass and ProxyPassReverse are configured

The correct address of tomcat, such as http: // localhost/oa/, is displayed in the address bar http: // localhost: 8080/oa/. Otherwise, add the line ProxyPassReverse, the apache address is displayed, and the original tomcat is hidden.

In this configuration, We proxy all http: // localhost requests to http: // localhost: 8080/, which is Tomcat's

Access address, except for the images, css, and js directories.

Currently, the latest Apache cache can only be configured at the server or virtual host level, but cannot be configured at the URL level.

Fortunately, the general J2EE application performance problems are generally found in the dynamic web page section. The static Web page is good, so it does not matter much.

For highly demanding applications, such as news websites or Forum websites with a large number of users, if the requirement is to use Apache to buffer dynamic web pages in the background

For example, if my homepage can be cached for one minute, for example, two thousand user accesses http: // localhost: 8080/oa,

Apache forwards requests to Tomcat only for the first time. The remaining 999 accesses are all forwarded by Apache from the buffer.

Retrieve this page and return it to the user. In this way, the load on the dynamic Web Page Server in the background will be much smaller. The latest Apache version is used as an example.

If the reverse proxy fails to meet this requirement, you should use Apaceh to create a virtual host and use URL rewrite.

This has nothing to do with the question.

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.