One simple reason I had to consider the load
Xiaoyuan made a website. It is very simple. It is a traditional java open framework, and it can be done with a tomcat . What people do not expect is that since the website is popular, a tomcat will soon be out of order. What should I do?
The website has a lot of traffic. Since one tomcat ca n't handle it, can I use two tomcats ? If two tomcats can't handle it, I can consider using 3 or 4 tomcats
Then the problem comes, I first have to solve the two tomcats to work properly.
After looking for a lot of information, a common load method comes into view, nginx
what is nginx ? It doesn't matter, anyway, my current purpose is very simple, he can let me make two tomcats work normally. (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 _
Well, then install nginx first . As for the configuration, I don't want to think about it first, and if there are any performance issues, I'll talk about it later.
First, let’s talk about the current website deployment situation.
Well: the system is centos6.5, jdk is installed , tomcat is installed, and the network has been set up .
1. Install the required plug-ins first. After all, don’t worry about what he does, and then let’s talk about it after installation.
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
- Install PCRE , what does this thing do? 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.
3. Officially install nginx
Download nginx:
wget http://nginx.org/download/nginx-1.10.2.tar.gz
Unzip, install, in fact, this is the same as before, nothing
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.
Try to start first.
[root@host-2 sbin]# ./nginx
There seems to be no problem.
No matter what the configuration is, anyway, no error is reported, visit it on the browser first.
Very good, um, take a rest first, as for the specific configuration later. . . . .