Nginx load balancing for multiple tomcat under one machine
?
1 Download tomcat, free install version
Address: http://pan.baidu.com/s/1jGAgc5o
2. Copy a tomcat copy ( the following operation only needs to be in the copy )
The name is:
3. Modify Server.conf
Open File Location
Modify the following three places:
1.
2.
3.
?
?
?
?
?
?
?
?
4. Open Service.bat
Open File Location
?
Add the following
5 Install this Tomcat service
Command line Input: TOMCAT8.1.2 is the name of the service and is free to
?
6 start this service
needs to be started in the system Services list, i.e. services.msc found under TOMCAT8.1.2 service name, and then right-click to start, this time B-tomcat can run properly.
?
7. Testing
① in these two Tomcat , create a new project separately : Hello ; Create a new Project launch page: index.html ;
② on top 6 has been started 8888 port tomcat service, so just put Span style= "Font-family:helvetica; Background-color:white ">8080 port tomcat start.
③ input in the browser Http://localhost:8888/hello,http://localhost:8080/hello the results are as follows:
at this point, two Tomcat it's already installed.
?
?
?
Nginx Load Balancer Configuration
Download Nginx
Address: HTTP://PAN.BAIDU.COM/S/1PJGB2AF
?
Installation
Unzip to local free directory: Edit nginx.conf File:
in the http{} the contents of the following red boxes are added:
?
Starting and shutting down Nginx server
?
Test validation
- Installing nginx verification
Input Installation Nginx Server's IP and listening ports: if any of the following Nginx Success!
?
Load Balancing Verification
guaranteed to open two tomcat server (open two tomcat ports are: 8080 and 8888 )
- Native input: http://localhost:81/hello/,
- Other machines enter the IP address of the installation Nginx server + port (81) + Project name/
- The result is: Switch between two tomcat: (e.g.:)
At this point, nginx load balancer installation is complete!
Load balancing with multiple tomcat and Nginx under one server