Load balancing server nginx detailed installation tutorial and network deployment

Previous articleReview: One simple reason I had to think about load

Xiaoyuan made a website, very simple, the traditional java open framework, and a tomcat to get it.

What I didn't expect was that the website became popular, and the traffic volume was very large. Soon a tomcat could not handle it. What should I do?

Can I use two tomcats? If two tomcats can't be done, can I consider using 3 or 4 tomcats?

So the question is, how can I make the two tomcats work normally.

After looking for a lot of information, a common load method comes into view, nginx

what is nginx? It doesn't matter, just know that he can make the two tomcats work properly. (A black cat is a white cat, a cat who can catch mice is a good cat, and a cat that can solve problems is king)

 

install nginx

This chapter mainly solves the installation problem. As for the configuration and performance, other problems will be explained in detail below. Let's talk about the current website deployment situation first.

The system is centos6.5, jdk is installed, tomcat is installed, and the network has been set up.

  • Install the plugin

yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel

  • Install PCRE

What is this thing for? This is to make Nginx support Rewrite, so what is Rewrite? It is to allow different subdomains to challenge different directories, and different domain name rules to access different application servers.

Still don't understand? It doesn't matter, it's nothing more than putting on a new thing, just put it on.

Download it first

wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

Unzip the installation package

tar zxvf pcre-8.35.tar.gz

Enter the decompression directory to install

cd pcre-8.35

./configure

make && make install

View pcre version

pcre-config --version

Well, so far so easy.

But after so long, it seems that nginx has not been installed yet! ! !

  • Officially install nginx

Download nginx:

wget http://nginx.org/download/nginx-1.10.2.tar.gz

Unzip, install, in fact, this is no different from the previous

Install

cd /opt/module/nginx-1.10.2/

./configure

make && make install

After the installation is complete, enter the relevant directory and find a lot of things, these things seem to be familiar, logs, configuration files, etc.

Start a try.

[root@host-2 sbin]# ./nginx

No matter what the configuration is, anyway, there is no error, visit it on the browser first.

Leave some time for everyone to install nginx and configure our next chat~

Guess you like

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