-
创建 nginx.repo 文件
$ cd /etc/repos.d/ $ vim 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
-
安装
$ yum -y install nginx
-
启动
$ systemctl start nginx.service $ systemctl enable nginx.service