How to set reverse proxy in Apache
This article shows you how to set up reverse proxy in Apache, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. Brief introduction
Reverse proxy (Reverse Proxy) means that the proxy server accepts the connection request on the internet, then forwards the request to the server on the internal network, and returns the result obtained from the server to the client requesting the connection on the internet. At this time, the proxy server behaves as a reverse proxy server.
The figure below is a simple reverse proxy process.
2. Configuration
(1) first, make sure that Apache has these modules, and confirm these modules in the Apache root directory, which mainly includes the following modules:
Mod_proxy.so
Mod_proxy_ajp.so
Mod_proxy_balancer.so
Mod_proxy_connect.so
Mod_proxy_http.so
Open the configuration conf/httpd.conf file and remove the comments for these modules, as shown in the following figure:
(2) modify the configuration file, open the file conf/httpd.conf, and add the following configuration at the end of the file:
# reverse proxy
ProxyRequests Off
ProxyPass / clusterDemo http://127.0.0.1:8081/clusterDemo
ProxyPassReverse / clusterDemo http://127.0.0.1:8081/clusterDemo
ProxyPass / clusterDemo2 http://127.0.0.1:8082/clusterDemo2
ProxyPassReverse / clusterDemo2 http://127.0.0.1:8082/clusterDemo2
ProxyPass / clusterDemo3 http://127.0.0.1:8083/clusterDemo3
ProxyPassReverse / clusterDemo3 http://127.0.0.1:8083/clusterDemo3
# 8888 is the listening port of apache
AllowOverride None
Order Deny,Allow
Allow from all
(3) testing
Start apache and the corresponding http://www.bbqmw.net/qm_bbqmbd/ baby name the treasure book tomcat.
Enter the address on the browser: http://127.0.0.1:8888/clusterDemo/index.jsp
Enter the address on the browser: http://127.0.0.1:8888/clusterDemo2/index.jsp
The above is how to set up reverse proxy in Apache. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.