tomcat+nginx load balancing (windows7)

1. First copy two tomcat
tomcat1
tomcat2
Modify the default port number of tomcat
"tomcat+nginx load balancing (windows7)"
"tomcat+nginx load balancing (windows7)"
"tomcat+nginx load balancing (windows7)"
tomcat1 port default
tomcat2 port 8081
Set environment variables
"tomcat+nginx load balancing (windows7)"
"tomcat+nginx load balancing (windows7)"
Modify the configuration file
catalina.bat
startup.bat
shutdown.bat
In the tomcat1/bin directory, replace CATALINA_BASE in the three files with CATALINA_BASE and replace CATALINA_HOME with CATALINA_HOME1
Tomcat2 is the same
Modify the service.bat file
Modify CATALINA_BASE and CATALINA_HOME
Change the name to your own
set SERVICE_NAME=Tomcat7.1
set DISPLAYNAME=Apache Tomcat 7.0 %SERVICE_NAME%
Start the service Two tomcats have been started
"tomcat+nginx load balancing (windows7)"
nginx official website download nginx1.8
Modify the configuration file nginx.conf
Add the following (red font)
#gzip on;
upstream tomcat {
server 127.0.0.1:8080;
server 127.0.0.1:8081;
ip_hash;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://tomcat;
}
Dos enters the directory where nginx.exe is located
start nginx start
Visit http://127.0.0.1/project name

Guess you like

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