1. 恢复快照编译安装nginx

(1) 依次单击:虚拟机----快照----恢复快照。

(2) 安装下载工具wgetyum install wget -y(自动确认)

(3) cd /opt(第三方软件存放位置)(记得提前安装开发工具)

(4) 首先:wget http://nginx.org/download/nginx-0.6.38.tar.gz

其次:tar zxvf nginx-0.6.38.tar.gz

再次: 29  cd nginx-0.6.38

最后:./configure

报错(1):./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.

输入:yum install pcre-devel,回车,输入: ./configure

报错(2):./configure: error: the HTTP gzip module requires the zlib library.

You can either disable the module by using --without-http_gzip_module

option, or install the zlib library into the system, or build the zlib library

statically from the source with nginx by using --with-zlib=<path> option.

输入:install zlib-devel,回车,输入: ./configure

出现:Configuration summary

  + using system PCRE library

  + OpenSSL library is not used

  + md5 library is not used

  + sha1 library is not used

  + using system zlib library

正常。回车,输入: ./configure,执行下一步操作。

(5)输入:make ,回车。

(6)输入:make install ,回车。

(7)输入:ll /usr/local/,查看是否有 nginx文件,有就是安装成功了。

 

2. 恢复快照使用rpm安装nginx

(1)依次单击:虚拟机----快照----恢复快照。

(2)安装下载工具wgetyum install wget -y(自动确认)

(3)安装nginx的库:

1)下载库:

http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2)安装库:

rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

 

(4)安装nginx版本:

1)下载:

wget http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-2.el7.ngx.x86_64.rpm

2)

rpm -ivh nginx-1.18.0-2.el7.ngx.x86_64.rpm

(5) 查看是否安装成功

输入: rpm -q nginx    显示:nginx-1.18.0-2.el7.ngx.x86_64,则可能成了。

 

3. 恢复快照使用yum安装

1)依次单击:虚拟机----快照----恢复快照。

2)安装下载工具wgetyum install wget -y(自动确认)

3)安装库:

1)下载库:

http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2)安装库:

rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

(4)安装nginx

输入:Yum install nginx -y

(5)查看是否安装

输入:rpm -q nginx 显示:nginx-1.18.0-2.el7.ngx.x86_64 ,可能成了。