Home >Backend Development >PHP Tutorial >Nginx installation and deployment under CentOs
System: centOS
First, install gcc, gcc-c++, make and other compilation tools
Yum install XXXX
Nginx Install
Module dependencies Nginx needs to depend on the following 3 packages
1. The gzip module requires zlib library (Download : http:// www.zlib.net/ )
2. The rewrite module requires the pcre library (Download: http://www.pcre.org/ )
3. The ssl function requires openssl library (Download: http://www.openssl.org/)
Nginx Package download: http://mirrors.sohu.com/nginx/
The installation order of dependent packages is: openssl, zlib, pcre, and then install Nginx package
Download pcre dependency package
Downloadopenssl
Dependency package
DownloadNginx
packageChoose Stable version of
Fully prepared installation package
:
openssl-fips-2.0.9.tar.gz
zlib- 1.2.
8.tar.gz
pcre-8.
32.tar.gznginx-1.
9.1 .tar.gz Second step:
Install openssl-fips-2.0.9.tar.gz, zlib-1.2.
8.tar.gz, pcre-8 in sequence .32.tar.gz, nginx-1.9.1
.tar.gz1. Install
openssl-fips-2.0.9.tar.gz [root@localhost mrms]# tar -zxvf openssl-fips-2.0.9.tar.gz [root@localhost mrms]# cd openssl-fips-2.0.9[root@localhost openssl -fips-2.0.9]# ./config [root@localhost openssl-fips-2.0.9]# make[root@localhost openssl-fips-2.0.9]# make install
2. Install
tar.gz [root@localhost mrms]# tar -zxvf zlib-1.2.8.tar.gz [root@localhost mrms]# cd zlib-1.2.8 |
[root@localhost zlib -1.2.8]#make install
3.Install
.tar.gz [root@localhost mrms] # tar -zxvf pcre-8.32.tar.gz[root@localhost mrms]# cd pcre-8.32 |
[root@localhost pcre-8.32]#make install
4. Install nginx-1.9.1.tar.gz
[root@localhost mrms]# tar -zxvf nginx-1.9.1.tar.gz [root@localhost mrms]# cd nginx-1.9.1 [root@localhost nginx-1.9.1]#./configure --sbin-path=/usr/local/nginx/nginx --conf-path =/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-pcre=/usr/local/src/pcre-8.32 - -with-zlib=/usr/local/src/zlib-1.2.8 --with-openssl=/usr/local/src/openssl-fips-2.0.9 [root@localhost nginx-1.9.1 ]# make [root@localhost nginx-1.9.1]# make install |
Now the installation of Nginx is completed!
Check whether the installation is successful
[root@localhost nginx-
1.9.1]# cd /usr/local/nginx/
[root@localhost sbin]# ./nginx -t
As shown in the picture, it means
Nginx is successfully installed.
Startnginx
[root@localhost sbin]# ./nginx
View Port
[root@localhost sbin]# netstat -ntlp
The above introduces the installation and deployment of Nginx under CentOs, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.