下载对应当前系统版本的nginx包(package)

安装 openssl 、 zlib 、 gcc 、pcre依赖

1
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre-devel

安装 pcre 依赖:

1
2
3
4
wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz
tar -xvf pcre-8.45.tar.gz && cd pcre-8.45
./configure
make && make install

下载nginx的rpm包:

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

建立nginx的yum仓库

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

安装nginx

1
yum install nginx -y

启动nginx服务

1
systemctl start nginx