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

How to install nginx1.12.1 under centos6.4

WBOY
Release: 2023-05-13 19:10:10
forward
1011 people have browsed it

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++
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

Installation

1.nginx URL

2.Use wget command to download

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

How to install nginx1.12.1 under centos6.4

3. Unzip

#tar -zxvf nginx-1.12.1.tar.gz
#cd nginx-1.12.1
Copy after login

How to install nginx1.12.1 under centos6.4

4.Configuration

#./configure
Copy after login

How to install nginx1.12.1 under centos6.4

5. Installation

#make
Copy after login

How to install nginx1.12.1 under centos6.4

#make install
Copy after login

Find the installation path:

#whereis nginx
Copy after login

Start and stop nginx

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

./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
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template