Apache2.4 + Tomcat6 cluster configuration notes

1. Install Apache
1. Modify the path c:/Apache24 in httpd.conf to the path of the Apache installation package, such as: D:/httpd-2.4.12/Apache24
2. Enter the bin directory under the Apache installation directory:
httpd.exe -k install
3. Start the service httpd.exe -w -n "Apache2.4" -k start
(uninstall the service sc delete Apache2.4)

2. Configure Apache
1. Open the conf/httpd.conf file and load the following module
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule speling_module modules /
mod_speling.so LoadModule ssl_module modules/mod_ssl.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so

2. Remove the comment before Include conf/extra/httpd-vhosts.conf

3. At the end of the file Add reverse proxy
ProxyRequests Off
<proxy balancer://cluster>
BalancerMember ajp://127.0.0.1:11007 loadfactor=1 route=tomcat1
BalancerMember ajp://127.0.0.1:11008 loadfactor=1 route=tomcat2
BalancerMember ajp:/ /127.0.0.1:11009 loadfactor=1 route=tomcat3
</proxy>

4. Open the conf/extra/httpd-vhosts.conf file and configure the virtual site
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName localhost
ServerAlias localhost
ProxyPass / balancer://cluster/ stickysession=jsessionid nofailover=On
ProxyPassReverse / balancer://cluster/
ErrorLog "logs/lbtest-error.log"
CustomLog "logs/lbtest-access.log" common
</VirtualHost>

3. Configure tomcat
1. Copy 3 tomcats
2. Modify server.xml of tomcat2
<Server port="8005" shutdown="SHUTDOWN">Change port to 8006

<Connector connectionTimeout="20000" port="8080" protocol= "HTTP/1.1" redirectPort="8443"/>Change port to 8090

<Connector port="11008" protocol="AJP/1.3" redirectPort="8443"/>Change port to 11008

<Engine defaultHost="localhost" name="Catalina" >Add jvmRoute="tomcat2", also add jvmRoute="tomcat1" in tomcat1 to
open <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>Note
3. Modify the server of tomcat3 .xml, the same as tomcat2, change the port to 11009, add jvmRoute="tomcat3", ensure that the ports of the three tomcats are different, and the port of AJP is the same as the proxy port configured in the httpd.conf file.

Fourth, the web in the project.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326471737&siteId=291194637