First, Tomcat installation and configuration

/usr/local/dev/ usr/local/dev/

Vi /etc/profile = /etc/profile = /etc/profile

3, source /etc/profile to make the configuration file take effect

Two Single-node deployment multiple applications

# OS specific support. $var must be set to either true or false. $var must be set to either true or false. Add it under this

2. The first tomcat1 file remains unchanged. Go to the conf directory of Tomcat2 and run the vi server. XML fileCopy the code

3. Make the changed server.xml take effect

4. Start the two Tomcat servers, as shown in the figure:

5. Access both Tomcats

I installed Linux on the VM in Windows. First look at the IP address of Linux (use ifconfig command to view it). Then access ports 8080 and 9080 (configured in server.xml), where tomcat. PNG under webapps/root in tomcat2 directory is changed to a different image to distinguish between them

If not, clear the browser cache and disable the Linux firewall (Service iptables stop).

Load balancing with Nginx

1. Install Nginx. I’m using Tengine

Click Download and unzip it to a directory like mine in /usr/local/dev, as shown

Compile and install:

After compiling and installing:

Enter sbin of nginx to start nginx (default port 80 of nginx)

Of course, you can also set a domain name on Windows so that you can change the IP address when accessing Windows. In Windows, edit the C:\Windows\System32\drivers\etc\hosts file and add the following

so Visit www.woka.com:8080, www.woka.com:9080, www.woka.com:8080 is the same effect

2. Load configuration

  • Create a directory such as host in the nginx/conf directory

  • Create a file such as balance-conf in the host directory and fill in the following information:

  • Run vi nginx.conf in the nginx/conf directory to add the configuration file that contains the configuration file you just created

  • /nginx -s reload in the sbin directory./nginx -s reload on www.woka.com