Apache2.2 and above integrated configuration and load balancing with Tomcat
- 2020-05-09 19:37:25
- OfStack
Today, the technical director asked the integration of Apache and Tomacat to be realized. After searching a lot of information on the Internet, he found that it was still the most convenient!
Below is the implementation of 2 tomcat load balancing, if only 1 can be deleted 1
apache2.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
Just get rid of the # in front of these two lines
And then I'm going to add it to the end
Done!! B: yes, that's what I'm using now.
Below is the implementation of 2 tomcat load balancing, if only 1 can be deleted 1
apache2.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
Just get rid of the # in front of these two lines
And then I'm going to add it to 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!! B: yes, that's what I'm using now.