Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use nginx and tomcat to build load balancing environment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "how to use nginx and tomcat to build a load balancing environment". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to build a load balancing environment using nginx and tomcat".

JDK installation

1. Download the corresponding version of Java1.7

A) phenomenon: how to view the Linux version:

Uname-m: 32-bit kernel if i386 or i686

2. Install Java1.7

Download the rpm package, and then chmod gives 777 permissions before installing

3. Configure JDK environment variables

A 、 vi / etc/profile

Add at the end:

Export JAVA_HOME=/usr/java/jdk1.7.0_60

Export CLASSPATH=.:$JAVA_HOME/lib

Export PATH=$JAVA_HOME/bin:$PATH

B, source / etc/profile: reload environment variables

4. Java-version: verify whether the installation is successful

PS: I don't know where to download jdk. You can download it here: http://www.xqtesting.com/blog/jdk-103.html

Installation of Nginx

Download, then unzip and upload to linux, then go to the directory of nginx and execute the following command:

. / configure-- prefix=/opt/nginx-- with-http_stub_status_module-- with-http_ssl_module-- with-threads-- with-pcre= here refers to the path of the decompressed file address of pcre

Make & & make install

Verify:

Start:

/ opt/nginx/sbin/nginx

Restart:

/ opt/nginx/sbin/nginx-s reload

Installation of Tomcat

Download and decompress Tomcat with 7. 0, and copy it out and put the two tomcat1,tomcat2 into the opt directory

If the three ports of tomcat1 are: 8005 8009 8080, then the tomcat2 ports are all + 1000, that is, 9005 9009 9080

Verify:

Access the corresponding port separately and the page can be displayed.

Modify the index.jsp home page and add some text to it so that you can tell which tomcat is visited.

Integration

Modify nginx configuration file

Verify:

Directly access the virtual machine ip, and you can see that different tomcat has been accessed by brushing it several times.

It's best to use the Firefox browser to read it.

These are all the contents of the article "how to use nginx and tomcat to build a load balancing environment". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report