Advantages of using Nginx
Nginx as a Web server, nginx processing static files, index files, automatic indexing is very efficient.
Nginx as a proxy server, Nginx can implement the reverse proxy without caching, improve the performance of the website
Nginx as a load balancing server, the internal can support PHP, also can support the external service of HTTP proxy server, but also support simple fault tolerance and the use of algorithms to load;
Nginx in terms of performance: Nginx is designed for performance optimization, performance is its most important consideration, the implementation of very focused on efficiency. It supports the kernel poll model, which can withstand high load, and reports indicate that it can support up to 50,000 concurrent connections.
Nginx has high stability, other HTTP servers are experiencing spikes in access, or someone maliciously initiates
Slow connections are also likely to cause the server to run out of physical memory for frequent swapping, which can only restart the server if it loses its response. For example, when Apache is up to more than 200 processes at the moment, the Web response is significantly slower. Nginx has adopted a phased resource allocation technique, which makes its CPU and memory occupancy rate very low. Nginx official says it maintains 10,000 inactive connections, which only account for 2.5M of memory, so attacks like dos are useless to nginx;
Nginx High-availability: Nginx supports hot deployment, it's very easy to start, and can almost do 7*24 uninterrupted, even after months of running without restarting. You will also be able to upgrade the software version with uninterrupted service.
First, install Nginx configuration file
1, before the installation, please ensure that the development environment-dependent package is installed;
Rpm–qa | grep gcc gcc-c++
Rpm–qa | grep OpenSSL
Rpm–qa | grep pcre
2, install Nginx server;
Nginx-0.8.29.tar.gz Tar zxvf
ls
Useradd nginx-s/sbin/nologin
CD nginx-0.8.29
Mkdir/usr/local/nginx
/configure--prefix=/usr/local/nginx--user=nginx--group=nginx--with-http_stub_status_module--with-http_ssl_ Module
&& make Install
3, create the virtual directory, modify the configuration file
[Root@centos6 sbin]#./nginx
[Root@centos6 sbin]# pwd
/usr/local/nginx/sbin
4, and then to test whether it can open;