Apache2.2 and above integrated configuration with Tomcat and load balancing implementation
- 2020-05-06 12:06:55
- OfStack
Today, the technical director asked to achieve Apache and Tomacat integration, on the Internet to find a lot of information, and found that this is the most convenient!
The following is the implementation of two tomcat load balancing, if only one can be deleted one
Es9en2.2 or above, no need to use jk_mod to integrate tomcat, directly use ajp, very convenient.
Modify the apache configuration file httpd.conf
Enable mod_proxy_ajp
can be done by removing the # from the front of the two lines
Then add
at the end
Done!! Yes, that's what I'm using.
The following is the implementation of two tomcat load balancing, if only one can be deleted one
Es9en2.2 or above, no need to use jk_mod to integrate tomcat, directly use ajp, very convenient.
Modify the apache configuration file httpd.conf
Enable mod_proxy_ajp
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
can be done by removing the # from the front of the two lines
Then add
at the end
<VirtualHost *:80>
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
ServerName a.hackang.cn
</VirtualHost>
<VirtualHost *:80>
ProxyPass / ajp://127.0.0.1:9009/
ProxyPassReverse / ajp://127.0.0.1:9009/
ServerName b.hackang.cn # The name here can be changed localhost
</VirtualHost>
Done!! Yes, that's what I'm using.