Home  >  Article  >  Backend Development  >  Install nginx-1.6.2 under centos7 (64-bit)

Install nginx-1.6.2 under centos7 (64-bit)

WBOY
WBOYOriginal
2016-08-08 09:31:57959browse

Linux system is Centos 64-bit

Step 1: Download the corresponding version from http://nginx.org/download/ (or wget http://nginx.org/download/nginx-1.5. 9.tar.gz can be downloaded directly on Linux using the command)

Step 2: Unzip tar -zxvf nginx-1.5.9.tar.gz

Step 3: Set the configuration information ./configure --prefix=/usr/local/nginx, or do not perform this step and directly configure the default configuration

Step 4:

make compile (the make process is to convert source code files written in various languages ​​into executable files and various library files)

make install installation (make install is to copy these compiled executable files and library files to the appropriate place)

When configuring information, that is, In the third step, an error occurred:


The error is: ./configure: error: the HTTP rewrite module requires the PCRE library.

Install pcre-devel to solve the problem
yum - y install pcre-devel

may also occur:


install zlib-devel to solve the problem
yum -y install zlib-devel

There may also be:

Error message: ./configure: error: the HTTP cache module requires md5 functionsfrom OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl= options.

Solution:

yum -y install openssl openssl-devel

Start and shut down nginx under linux after installation:

Start operation

/usr/nginx/sbin/ngin x (/ usr/nginx/sbin/nginx -t Check whether the configuration information is correct)

web interface: http://192.168.189.136:80/

Stop operation
Stop operation is performed by sending a signal to the nginx process (please refer to the linux article for what is a signal)
Step 1: Query the nginx main process number
ps -ef | grep nginx
Look for the master process in the process list. Its number is the main process number.
Step 2: Send signal
Stop Nginx gracefully:
kill -QUIT main process number
Stop Nginx quickly:
kill -TERM main process number
Force stop Nginx:
pkill -9 nginx
In addition, if the pid file storage path is configured in nginx.conf, the file will store the Nginx main process number. If not specified, it will be placed in the nginx logs directory. With the pid file, we do not need to query the main process number of Nginx first, but directly send a signal to Nginx. The command is as follows:
kill -Signal type '/usr/nginx/logs/nginx.pid'
Smooth restart
If you change the configuration, you need to restart Nginx. Do you need to close Nginx first and then open it? No, you can send a signal to Nginx to restart smoothly.
Smooth restart command:
kill -HUP Enter the name or process number file path

or use

/usr/nginx/sbin/nginx -s reload


The above introduces the installation of nginx-1.6.2 under centos7 (64-bit), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn