安装完虚拟机后
先更换yum源
yum install wget
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum update -y
安装 nginx
yum install nginx -y
添加nginx yum 源
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx -y 再来
有点儿慢等会吧
好了
systemctl restart nginx
systemctl enable nginx 开机自启
systemctl stop firewalld
systemctl disable firewalld
配置文件
/etc/nginx/nginx.conf
/etc/nginx/conf.d/default.conf 主要修改该文件
html文件默认路径
/usr/share/nginx/html
一般碰到的问题大都是防火墙/端口问题
原文:https://www.cnblogs.com/duoban/p/12492621.html