First, installation Preparation
First, because some of the Nginx modules rely on some Lib library, so before installing Nginx, you must first install these Lib libraries, these dependent libraries mainly have g++, GCC, openssl-devel, pcre-devel and Zlib-devel so execute the following command installation
$ yum Install gcc-c++ $ yum Install pcre pcre-devel $ yum Install zlib zlib-devel $ yum Install OpenSSL OpenSSL
Second, install Nginx
Before installing, it is advisable to check if Nginx is installed
$ find-name Nginx
If the system has Nginx installed, first uninstall the
$ yum Remove Nginx
First enter the/usr/local directory
$ cd/usr/local
Download the latest version of Nginx from official website
$ wget http://nginx.org/download/nginx-1.8.0.tar.gz
Unzip the Nginx compression pack
$ TAR-ZXVF nginx-1.8. 0. tar.gz
will produce a nginx-1.8.0 directory, then enter the nginx-1.8.0 directory
$ cd nginx-1.8. 0
Next install, use the--prefix parameter to specify the Nginx installation directory, make, make install installation
$./configure--prefix=/usr/local/nginx$ make$ make install
If there is no error, after the successful completion, it is best to look at the Nginx installation directory
$ Whereis Nginx
Once the installation is complete, you can start or stop it by entering the post-installation directory (/usr/local/nginx).
$ cd/usr/local/nginx$ sbin/nginx
In this, the use of CentOS installation Nginx has been completed, in fact, it is quite simple to see.
CENTOS7 Installation Configuration Nginx