Tags: nginx introduction nginx installation

If you’ve ever heard of Apache software, you’ll quickly become familiar with nginx software, which, like Apache software, is an open source, high-performance, highly concurrent WWW service and proxy service software

nginxBecause of its high concurrency (especially static resources) and less system resources, it has rich functions.

Nginx is not only an excellent web service software, but also has the function of reverse proxy load balancing and cache service. it is similar to the well-known reverse proxy and load balancing softwareLVSProfessional agent software such as load balancing and HAPROXY,But NGINX is more convenient to deploy, and it is similar to the function of caching services.Squidetc.Professional caching service software

Summarize the major functions of nginx:

1)www webservice

2)Load balancing (also known as reverse proxy, also called proxy).

3)web Cache (equivalent to squid, CDN mainly uses SQUID).


1、The configuration is simple, flexible and lightweight.

2、High concurrency (static small files), tens of thousands of concurrency.

3、Occupy less resources 2W concurrent, open 10 thread services, memory consumption of several hundred M


1.Installation of nginx requires installation of PCRE libraries and OpenSSL

pcreThe PCRE library is installed to enable nginx to support rewrite modules with URL rewriting capabilities ifIf you don’t install the PCRE library, nginx can’t use the rewrite function. The Rewrite Module Function of nginx is almost necessary for enterprise applications.

yum install -y pcre pcre-devel 

rpm -qa pcre pcre-devel

Note: the PCRE version of RPM installation is somewhat low, but generally does not affect usage.

opensslIt is the function of encryption. Nginx will use this module when using HTTPS services.

yum install openssl openssl-devel

rpm -qa  openssl openssl-devel

2.Select and download the appropriate version of nginx.

nginxThe official website is: www.nginx.org can see all versions of nginx.

nginxThere are three versions of the software, the stable version, the development version, and the historical stable version.

The selection criteria are as follows:

Development version updates faster, new functions are more, but bug more.

The stable version is slow to update, but less bug, which can be the first choice for the enterprise’s production environment.

But in practice, it is better to avoid using the latest stable edition as much as possible and choose a version 6-10 months later than the latest one already published.

The official website’s explanation is this:

NginxThe official website provides three types of versions.
Mainline version:Mainline Nginx is currently the main version of the development, it can be said that the development version.
Stable version:The latest stable version, the recommended version of the production environment.
Legacy versions:Legacy version of stable version

To sum up, we choose1.8.1 

3.Start installing nginx

mkdir -p /app/3rd/nginx

cd /app/3rd/nginx

wget http://nginx.org/download/nginx-1.8.1.tar.gz

tar zxvf nginx-1.8.1.tar.gz 

[[email protected] nginx-1.8.1]# ./configure –help View compilation options

– prefiX=/app/zpy/nginx-1.8.1/ \

How do we see the successful compilation?

[[email protected] nginx-1.8.1]# echo $?



Last step:

ln -s /app/zpy/nginx-1.8.1 /app/zpy/nginx

4.start nginx

1 “check the configuration files and syntax of nginx:

/app/zpy/nginx/sbin/nginx -t

nginx: the configuration file /app/zpy/nginx-1.8.1//conf/nginx.conf syntax is ok

nginx: configuration file /app/zpy/nginx-1.8.1//conf/nginx.conf test is successful

2)Check whether the 80 port is occupied:

[[email protected] zpy]# netstat -tunpl | grep 80

tcp        0      0 :::80       :::*      LISTEN      20804/httpd 

We found that 80 had been occupied by httpd Apache, so we stopped httpd.

service httpd stop

chkconfig httpd off



[[email protected] zpy]# netstat -tunpl | grep 80

tcp     0    0*     LISTEN      8398/nginx  

Browser input can see nginx page.

nginxIntroduction and installation

Tags: nginx introduction nginx installation

Original address: http://dailiang.blog.51cto.com/9484865/1825850

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *