1. First download the decompressed version of tomcat;
2. Name them tomcat1 and tomcat2 respectively;
3. Go to the config directory and open the server.xml file
Modify 3 places, as follows:
1)<Server port="8002" shutdown="SHUTDOWN">
port The port number is modified to be different;
2) tomcat startup port
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
Modify the port number
3) <Connector port="8029" protocol="AJP/1.3" redirectPort="8443"/>
modify the port
4. After the file modification is completed, start tomcat separately, access different port numbers, and test whether it is ok.
ps:nginx: High performance HTTP and reverse proxy server.
Simple configuration for load balancing:
In the installed directory, modify nginx.conf:
upstream tomcat_server{
server localhost:8080 weight=1;
server localhost:8088 weight=5;
}
The weight attribute indicates the weight of each server being accessed. The higher the weight, the higher the probability of access.
In the server configuration, modify
location / {
proxy_pass http://tomcat_server;
# root html;
# index index.html index.htm;
}