3、安装nginx

1、安装

官方文档

http://nginx.org/en/linux_packages.html#RHEL-CentOS

sudo yum install yum-utils

sudo yum install nginx

2、启动

启动服务

systemctl start nginx

加入开机启动

systemctl enable nginx

防火墙需要放行80端口,或者其他你配置的端口,参考

 https://www.cnblogs.com/heqiuyong/p/10460150.html

在浏览器输入

http://虚拟机ip/

如果出现

说明启动成功了

踩坑说明

linux有一个叫SELinux安全模块,具体我没研究是干啥的,反正他开着,会影响我们后续网站的反向代理操作,所以先把他关掉

vim /etc/selinux/config 

把里面的 SELINUX 改成 disabled 

执行 

setsebool -P httpd_can_network_connect 1

原文地址:https://www.cnblogs.com/ares-core/p/12957354.html