1. installation preparation some modules of nginx depend on some lib libraries. Therefore, you must install these lib libraries before installing nginx, these dependent libraries mainly include g ++, gcc, openssl-devel, pcre-devel, and zlib-devel. Therefore, run the following command to install [html] viewplaincopy. 1. installation preparation
First, some modules of nginx depend on some lib libraries. Therefore, you must install these lib libraries before installing nginx, these dependent libraries mainly include g ++, gcc, openssl-devel, pcre-devel, and zlib-devel. Therefore, run the following command to install
[Html]View plaincopy
- $ Yum install gcc-c ++
- $ Yum install pcre-devel
- $ Yum install zlib-devel
- $ Yum install openssl -- devel
II. install Nginx
Before installing nginx, check whether nginx is installed.
[Html]View plaincopy
- $ Find-name nginx
If the system has installed nginx, uninstall it first.
[Html]View plaincopy
- $ Yum remove nginx
First, go to the/usr/local directory.
[Html]View plaincopy
- $ Cd/usr/local
Download the latest nginx version from the official website
[Html]View plaincopy
- $ Wget http://nginx.org/download/nginx-1.7.4.tar.gz
Decompress the nginx package
[Html]View plaincopy
- $ Tar-zxvf nginx-1.7.4.tar.gz
A nginx-1.7.4 directory is generated and you enter the nginx-1.7.4 Directory
[Html]View plaincopy
- $ Nginx-1.7.4 cd
Next, use the -- prefix parameter to specify the nginx installation directory. make and make install
[Html]View plaincopy
- $./Configure $ installed in/usr/local/nginx by default
- $ Make
- $ Make install
If no error is reported, check the nginx installation directory.
[Html]View plaincopy
- $ Whereis nginx
After installation, you can start or stop the Directory (/usr/local/nginx) after installation.
At this point, the installation of nginx using CentOS has been completed. In fact, it is quite simple.