yum update
安装nginx最新源:
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"
安装nginx
yum -y install nginx
启动nginx
/bin/systemctl start nginx.service
此时在浏览器地址栏输入您的ip地址,如果出现nginx欢迎页则表示nginx安装成功,如下图:
![](https://box.kancloud.cn/a18ad63c4801b17dc918fe2a668102ba_664x137.png)
设置nginx服务器开机自启动
systemctl enable nginx.service
检查开机自动是否设置成功
systemctl list-dependencies | grep nginx 如下图:
![](https://box.kancloud.cn/aa9d52327b2066ff17bb9aed4dd52030_666x56.png)