1. nginx excellent properties as a reverse proxy, irreplaceable role includes:
- Exchange the HTTP layer can be used to split a user, such as the user's ID is even or odd shunted
- Load Balancing
- Server for caching
- URL rewrite: URL Rewrite
- Install third-party plug-ins to achieve health monitoring
Nginx can respond to thousands of requests at the same time, the efficiency is higher than the Apache Server.
2. Nginx configuration for load balancing company in two ways:
- The weight: location -> proxy_pass -> upstream -> upstream in different backend Server configuration different weight
- The Hash: location -> proxy_pass -> upstream -> Server assigned to different backend after the upstream position after the requested domain Hash
3. Install
Before installing nginx, you must install pcre, to support the rewrite, regular and web compression, and so on. So you need to install perl lot of support modules, which are packaged as a pcre, you can use yum install to install, you can go to the official website to download the latest version of prce package.
Download package installation process is as follows:
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.gz
Decompression
cd to the directory
执行./configure --enable-utf8
A check make check
The installation program make && make install
Next, install nginx, substantially similar to the steps above: wget http://nginx.org/download/nginx-1.7.1.tar.gz
Decompression
cd to the directory
执行 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
Perform the installation: make install
After the installation is complete, verify:
cat /usr/local/nginx/conf/nginx.conf
cd /usr/local/nginx/sbin
./nginx -t
appear:
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
start up
./nginx
It means success.
Reproduced in: https: //www.cnblogs.com/chongchong201399/p/3783788.html