Home  >  Article  >  Operation and Maintenance  >  How to install nginx1.12.1 under centos6.4

How to install nginx1.12.1 under centos6.4

WBOY
WBOYforward
2023-05-13 19:10:10987browse

Installation required environment

1. gcc installation

To install nginx, you need to compile the source code downloaded from the official website first. Compilation depends on the gcc environment. If there is no gcc environment, you need to install:

yum install gcc-c++

2. pcre pcre-devel installation

pcre(perl compatible regular expressions) Is a perl library that includes a perl-compatible regular expression library. The http module of nginx uses pcre to parse regular expressions, so the pcre library needs to be installed on Linux. pcre-devel is a secondary development library developed using pcre. nginx also requires this library. Command:

yum install -y pcre pcre-devel

3. zlib installation

The zlib library provides many compression and decompression methods. nginx uses zlib to gzip the contents of the http package. , so the zlib library needs to be installed on centos.

yum install -y zlib zlib-devel

4. openssl installation

openssl is a powerful secure sockets layer cryptographic library, including major cryptographic algorithms, commonly used keys and The certificate encapsulates management functions and SSL protocols, and provides a rich set of applications for testing or other purposes.

nginx not only supports the http protocol, but also supports https (that is, transmitting http over the ssl protocol), so you need to install the openssl library on centos.

yum install -y openssl openssl-devel

Installation

1.nginx URL

2.Use wget command to download

#wget -c https://nginx.org/download/nginx-1.12.1.tar.gz

How to install nginx1.12.1 under centos6.4

3. Unzip

#tar -zxvf nginx-1.12.1.tar.gz
#cd nginx-1.12.1

How to install nginx1.12.1 under centos6.4

4.Configuration

#./configure

How to install nginx1.12.1 under centos6.4

5. Installation

#make

How to install nginx1.12.1 under centos6.4

#make install

Find the installation path:

#whereis nginx

Start and stop nginx

#cd /usr/local/nginx/sbin/
./nginx 
./nginx -s stop
./nginx -s quit
./nginx -s reload

./nginx -s quit: The stop step in this method is to stop the nginx process after the task is completed.
./nginx -s stop: This method is equivalent to first finding out the nginx process ID and then using the kill command to forcefully kill the process.

Query the nginx process:

#ps aux|grep nginx

Start nginx and enter localhost in the browser

How to install nginx1.12.1 under centos6.4

The above is the detailed content of How to install nginx1.12.1 under centos6.4. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete