QQ交流群:121160124
关注微信公众号:邂逅最美的时光
参考:http://nginx.org/en/linux_packages.html
用户:root 其它非管理员用户加前缀sudo
Installation instructions
Before you install nginx for the first time on a new machine, you need to set up the nginx packages repository. Afterward, you can install and update nginx from the repository.
安装说明:
在一台新服务器上安装NGINX时,需要配置NGINX包repository,然后你可以安装和更新NGINX。
1.安装前提依赖
yum install yum-utils
2.添加 NGINX repository
vim /etc/yum.repos.d/nginx.repo
在文件中添加如下配置然后保存
[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包的存储库。如果要使用主流nginx包,请运行以下命令:
yum-config-manager --enable nginx-mainline
3.安装NGINX
yum install nginx
等待安装完成即可!
启动NGINX:
service nginx start
关注微信公众号: