I. Installation and preparation
First, because some of Nginx's modules rely on Lib libraries, these Lib libraries must be installed before installing Nginx, which are mainly g++, GCC, Openssl-devel, Pcre-devel, and zlib-devel, so install the following command
[HTML] View plaincopy $ yum Install gcc-c++ $ yum Install pcre pcre-devel $ yum install zlib zlib-devel $ yu M install OpenSSL Openssl--devel
Second, install Nginx
Before installing, it's a good idea to check to see if nginx [HTML] View Plaincopy $ find-name is installed Nginx
If the system already has Nginx installed, then 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 [HTML] View plaincopy $ wget http://nginx.org/download/nginx-1.7.4.tar.gz from the website
Extract Nginx compressed package [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 Nginx installed directory, make, make install install [HTML] View Plaincopy $./configure $ default installed in/usr/local/nginx $ ma Ke $ 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
After installation, enter the post installation directory (/usr/local/nginx) to start or stop it.
To this end, the use of CentOS installation Nginx has been completed, in fact, it is quite simple to see.