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
[HTML]View Plaincopy
- $ yum Install gcc-c++
- $ yum Install pcre Pcre-devel
- $ yum Install zlib Zlib-devel
- $ yum Install OpenSSL Openssl--devel
Second, install Nginx
Before installing, it is advisable to check if Nginx is installed
[HTML]View Plaincopy
- $ find-name Nginx
If the system has Nginx installed, first uninstall the
[HTML]View Plaincopy
- $ yum Remove Nginx
First enter the/usr/local directory
[HTML]View Plaincopy
- $ cd/usr/local
Download the latest version of Nginx from official website
[HTML]View Plaincopy
- $ wget http://nginx.org/download/nginx-1.7.4.tar.gz
Unzip the Nginx compression pack
[HTML]View Plaincopy
- $ TAR-ZXVF nginx-1.7.4.tar.gz
will produce a nginx-1.7.4 directory, then enter the nginx-1.7.4 directory
[HTML]View Plaincopy
- $ CD nginx-1.7.4
Next install, use the--prefix parameter to specify the Nginx installation directory, make, make install installation
[HTML]View Plaincopy
- $./configure $ default installation in/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
[HTML]View Plaincopy
- $ Whereis Nginx
Once the installation is complete, you can start or stop it by entering the post-installation directory (/usr/local/nginx).
In this, the use of CentOS installation Nginx has been completed, in fact, it is quite simple to see.
Installation of Nginx