1,nginx下载,linux版本和windows版本分别是
linux:http://nginx.org/download/ windows:nginx.org/en/download.html
2,yum 安装,首先安装nginx的源
Install the prerequisites:
sudo yum install yum-utils
To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo
with the following contents:
[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key
注意各版本的区别:Nginx官网提供了三个类型的版本
1、Mainline version:Mainline 是 Nginx 目前主力在做的版本,可以说是开发版
2、Stable version:最新稳定版,生产环境上建议使用的版本
3、Legacy versions:遗留的老版本的稳定版
By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:
sudo yum-config-manager --enable nginx-mainline
也可以安装稳定版
sudo yum-config-manager --enable nginx-stable
To install nginx, run the following command:
sudo yum install nginx