创建源配置文件:

cd /etc/yum.repos.d/
sudo vim nginx.repo

填写内容:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

安装 Nginx:

sudo yum install nginx -y

启动 Nginx:

sudo /etc/init.d/nginx start

重启 Nginx:

sudo /etc/init.d/nginx restart

配置文件路径:

sudo vim /etc/nginx/nginx.conf
sudo vim /etc/nginx/conf.d/default.conf

参考连接:

2017-06-03 15:3412