Nginx compilation and installation

Source: Internet
Author: User
: This article describes how to compile and install Nginx. if you are interested in the PHP Tutorial, refer to it.
My system is CentOS-7, Nginx source code can be downloaded on the official website, URL: http://nginx.org/en/download.html, I downloaded the latest nginx-1.9.3.tar.gz download, decompress, and then need to install some necessary software to compile

(1) GCC compiler
The gcc compiler is a prerequisite for compiling a program. Use yum instal-y gcc for installation
(2) PCRE database
The PCRE library is a function library that supports positive expressions. if the regular expression is used in conf, the library must be compiled into Nginx during compilation, because the Nginx HTTP Module relies on it to parse the regular expression. Use the following command to download
Yum install-y pcre-devel
Pcre-devel is the development library required for secondary development using PCRRE, just like installing kernel-devel when developing the kernel source code. this development library contains header files, etc, is required to compile Nginx. Some tutorials on the Internet only say that you want to download pcre, but didn't download pcre-devel. I tried it and the compilation failed, so you still need to download both.
(3) zlib library
The zlib library is used to compress the HTTP package content by using gzip. gzip on is configured in the conf file, and gzip is used to compress some types of HTTP responses to reduce the amount of network transmission. you must compile the zlib library into Nginx and download it using the following command:
Yum install-y zlib-devel
Like the PCRE library, zlib library is used directly, and zlib-devel is used for secondary development.
(4) OpenSSL development Library
If our server does not know how to support HTTP and needs to transmit HTTP over a safer SSL protocol, we need to install the OpenSSL development library and use the following command to install it.
Yum install-y openssl-devel
Because it is the first installation, I use the default configuration. you can directly use the following command to complete the installation process.
./Configure
Make
Make install
After the three commands are executed, they are shown in the figure below.

Run the following commands to check whether Nginx is properly installed:
Run:/usr/local/nginx/sbin/nginx
Query nginx master process number: ps-ef | grep nginx
Stop process: kill-QUIT master process number
Stop: kill-TERM Master process number
(If you do not know whether Nginx has been installed before, run the find-name nginx command to check whether nginx has been installed. uninstall and run the command yum remove Nginx)

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

The above describes how to compile and install Nginx, including some content. if you are interested in the PHP Tutorial.

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.