Nginx Introduction and Installation

Source: Internet
Author: User
Tags install openssl

If you have heard of Apache software, then will be familiar with the Nginx software, similar to Apache software, Nginx (engine x) is an open source, supporting high-performance, high-concurrency WWW service and agent services software


Nginx has high concurrency (especially static resources), low occupancy system resources, and rich function

In terms of functional applications, Nginx is not only a good web services software, but also has reverse proxy load balancing and caching services, in reverse proxy, load balancing, it is similar to the famous LVs load balancing and Haproxy and other professional agent software , But Nginx deployment is more convenient, in the cache service function, it is similar to squid and other professional caching services software

Summarize the main features of Nginx:

1) WWW Web service

2) Load balancing (also referred to as reverse proxy or proxy)

3) Web cache (equivalent to SQUID,CDN mainly using squid)


Nginx Features:

1. Simple configuration, flexible, light weight

2, high concurrency (static small file), tens of thousands of concurrency

3, occupy less than 2W of resources, open 10 thread service, memory consumption hundreds of M



Nginx Installation

1. Installing nginx requires installation of Pcre library and OpenSSL

Pcre is all called Perl compatible regular expressions, in Chinese translated as "Perl compatible regular Expressions", the installation of Pcre library is to enable Nginx to support the URL rewrite function rewrite module, if not install Pcre library, Nginx can not use the rewrite function, Nginx rewrite module function is almost necessary for enterprise application

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 the use of

OpenSSL is a cryptographic function, and Nginx uses this module when using HTTPS services.

Yum Install OpenSSL Openssl-devel

Rpm-qa OpenSSL Openssl-devel


2. Select and download the appropriate Nginx version

Nginx Official website is: www.nginx.org can see all versions of Nginx

Nginx software available in three versions, stable version, development version, and historical stable version

The selection criteria are as follows:

Development version update fast, new features, but many bugs

Stable version of the update is slow, but fewer bugs, can be used as the preferred enterprise production environment.

But in practice, try to avoid using the latest stable version, you should choose a version that is 6-10 months late than the original published version.

The explanation of the official website is this:

Three types of versions available on Nginx website
Mainline Version:mainline is the current main version of Nginx, can be said to be a development version
Stable version: The latest stable edition, recommended versions for production environments
Legacy versions: Legacy old version of stable version

To sum up, we choose 1.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


./configure--user=zpy--group=zpy \
--prefix=/app/zpy/nginx-1.8.1/\
--with-http_stub_status_module \
--with-http_ssl_module

How do you think the compilation was successful???

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

0

Installation

Make
Make install

One final step:

Ln-s/app/zpy/nginx-1.8.1/app/zpy/nginx


4. Start Nginx

1) Check the Nginx configuration file and syntax:

/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 if Port 80 is occupied:

[Email protected] zpy]# NETSTAT-TUNPL | grep 80

TCP 0 0::: +:::* LISTEN 20804/httpd

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

Service httpd Stop

Chkconfig httpd off

3) Start

/app/zpy/nginx/sbin/nginx

[Email protected] zpy]# NETSTAT-TUNPL | grep 80

TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 8398/nginx


Browser input http://10.0.70.3 can see the Nginx page

Nginx Introduction and Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.