Nginx Compilation and Installation

Source: Internet
Author: User
我的系统是CentOS-7,Nginx的源码可以在官网下载,网址为:http://nginx.org/en/download.html,我下载了目前的最新版本nginx-1.9.3.tar.gz   下载后,解压缩,然后还需要安装一些必要的软件才能够编译

(1) GCC compilers
The GCC compiler is a prerequisite for compiling the program. Installing with Yum instal-y gcc
(2) Pcre Library
The Pcre library is a library of functions that supports positive expressions, and if you use regular expressions in nginx.conf, you must compile the library into Nginx at compile time, because the Nginx HTTP module relies on him to parse the regular expression. Use the following command to download
Yum install-y pcre Pcre-devel
Pcre-devel is to use Pcrre do two times development of the development of the library, just like the development of kernel source code to install Kernel-devel, the development library contains header files, etc., is required to compile nginx. Some tutorials on the web only said to download Pcre, but did not download pcre-devel, I tried the next, the compilation is unsuccessful, so still need to download two
(3) Zlib Library
The zlib library is used to make gzip-appropriate compression of the contents of the HTTP packet, and if we configure gzip on in nginx.conf and specify that for certain types of HTTP responses to be compressed using gzip to reduce network traffic, the Zlib library must be compiled into Nginx, Use the following command to download
Yum install-y zlib Zlib-devel
Like the Pcre Library, the Zlib library is a direct-use library, and Zlib-devel is a library for two development
(4) OpenSSL development Library
If our server does not know to support HTTP and also needs to transmit HTTP on a more secure SSL protocol, you will need to install the OpenSSL development Library and use the following command to install it.
Yum Install-y OpenSSL Openssl-devel
Because it is the initial installation, so I use the default configuration, directly using the following command to complete the installation process
./configure
Make
Make install
After the three instructions have been executed, the last one is as shown

Use some commands below to detect if Nginx is installed properly
Run:/usr/local/nginx/sbin/nginx
Query Nginx main process number: Ps-ef | grep nginx
Stop process: kill-quit main process number
Fast STOP: kill-term main process number
(If you do not know if you have previously installed Nginx, you can use the command find-name nginx to view, uninstall using the command yum remove Nginx)

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the Nginx compilation and installation, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.