1. Install dependent modules
. Download nginx-sticky plugin
yum install gcc yum install g++ yum install openssl openssl--devel yum install zlib zlib-devel yum install pcre pcre-devel yum -y install gcc-c++
2 , download
nginx
cd /usr/local
After that, enter the decompression directory:
wget http://nginx-sticky-module.googlecode.com/files/nginx-sticky-module-1.1.tar.gz tar -xzvf nginx-sticky-module-1.1.tar.gz
If the above dependent modules cannot be found during installation, use --with-openssl=
--with-pcre
< ;zlib_dir>Specifies the dependent module directory. If it has been installed, the path here is the installation directory; if it has not been installed, this path is the compiled installation package path, and nginx will perform the default compilation and installation of the module.
After passing the above steps, use the whereis
nginxcommand to view the nginx directory - it appears: nginx: /usr/local/nginx Open http://localhost in the browser :
ok,succeed!!!
Three, what can Nginx bring to my website? time :
. Server, at this time, the user's request will be processed by that application server. The choice of which application server will handle and respond to our user request falls on our load balancing device, so (ps: The picture below is just for implementation A model of load balancing, as well as other request and response processing models):
In addition, in addition to the role of request response as a selection, Nginx also has its own function in caching static resources. Advantages, so there is a technical combination of using Nginx to make up for the shortcomings of nodejs. At this time, our nginx server acts as a cache server.
The above introduces the installation of Nginx on CentOS 6, including centos and nginx. I hope it will be helpful to friends who are interested in PHP tutorials.