centos7下nginx的安装
2019-04-23 本文已影响0人
深蓝气质
打开nginx的官网
http://nginx.org/
进入下载界面
http://nginx.org/en/download.html

进入下面红框的链接
http://nginx.org/en/linux_packages.html
找到 RHEL/CentOS

按照说明进行安装
安装结束后,需要开启服务
查看自启服务状态
systemctl list-unit-files | grep nginx
查看状态
systemctl status nginx.service
启动服务
systemctl start nginx
开启自启
systemctl enable nginx.service
此时服务器已经可以访问了
如果是主机来访问虚拟机中nginx的服务,需要防火墙开启http和https
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
防火墙重载配置
firewall-cmd --reload
这样主机就可以访问虚拟中的nginx服务器了