Nginx Service quick startCatalog
- Nginx Service quick start
- One 、Nginx Introduce
- 1. What is? Nginx？
- 2. Why use Nginx？
- 3. What is forward agent ？
- 4. What is reverse proxy ？
- Two 、Nginx stay Linux Installation below
- 1. download
- 2. install
- 3、 ... and 、Nginx Getting started with configuration
- 1. The configuration file
- 2. Reverse proxy single server
- 3. Reverse proxy multiple servers
- Four 、 Run the test
- 1. Start the service
- 2. Close the service
- 5、 ... and 、 Load balancing
- 1. What is load balancing ？
- 2. To configure Nginx Load balancing
- One 、Nginx Introduce
One 、Nginx Introduce
1. What is? Nginx？
Nginx (engine x) Is a high-performance HTTP and Reverse proxy web The server , It also provides IMAP/POP3/SMTP service .
It is characterized by less memory , Strong concurrency , in fact nginx The concurrency ability of is better in the same type of web server .
2. Why use Nginx？
With the rapid development of the Internet today , A single point server has long been unable to support the continuous access of tens of thousands or even hundreds of thousands of users . Like a Tomcat In an ideal state, the server can only bear 2000 About one concurrency , To solve this problem , You need more than one Tomcat Server for load balancing .
that , How to achieve load balancing ？Nginx One of the solutions , When the user visits the site ,Nginx This access request was intercepted , And it is evenly distributed to different servers through polling .
also , stay Nginx There is a kind of ip_hash Strategy , It can get the user's real IP, To calculate the hash Value to select the server , This is also an excellent way of load balancing . therefore , master Nginx Become Web Development is an indispensable part of learning .
3. What is forward agent ？
Forward agency , That is, the client sends its request to the proxy server first , Forward the request to the server through the proxy server . That we use a lot VPN It's a proxy server , In order to connect to foreign websites , The client needs to use a server that can connect to the Internet as a proxy , And the client can connect to the proxy server .
4. What is reverse proxy ？
Reverse proxy is different from forward proxy , A forward proxy is a proxy for the client , The reverse proxy is the proxy server side . In the case of multiple servers distributed , In order to enable the client to access IP The address is the same website , You need to use reverse proxy .
After understanding the working mechanism of reverse proxy , Next you can enter Nginx Learning from ！
Two 、Nginx stay Linux Installation below
because Nginx Is widely used in Web Server , So this tutorial chose Centos Server's 7.4 Version as a demonstration ！
Go to the official download page version Stable version to download , And upload it to the server .
Upload tar After the package reaches the server , Unzip to the current directory
tar -zxvf nginx-1.18.0.tar.gz -C ./
Enter the unzipped directory , perform configure Script
Use make Command to install
make && make install
After installation , Use whereis Command find Nginx Installation position of ( Default installed in /user/local/ Under the table of contents )
Enter the bin Folder , start-up nginx service , Access the service .........
本文为[Program ape Owen]所创，转载请带上原文链接，感谢