一 . 安装nginx
复制代码
1
2yum install -y nginx
安装成功后默认网站目录: /usr/share/nginx/html
默认的配置文件:/etc/nginx/nginx.conf
二. 防火墙放开端口80和443
如果你的服务器打开了防火墙,你需要运行下面的命令,打开80和443端口。
复制代码
1
2
3
4firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
如果是阿里云服务器,需要打开安全组,放开80和443端口
三. Nginx的常规操作
1.启动 Nginx
复制代码
1
2systemctl start nginx
2.停止 Nginx
复制代码
1
2systemctl stop nginx
3.重启 Nginx
复制代码
1
2systemctl restart nginx
4.重载 Nginx
复制代码
1
2systemctl reload nginx
5.查看Nginx状态
复制代码
1
2systemctl status nginx
6.启用开机启动Nginx
复制代码
1
2systemctl enable nginx
7.禁用开机启动Nginx
复制代码
1
2systemctl disable nginx
最后
以上就是受伤大碗最近收集整理的关于centos 7 yum安装nginx的全部内容,更多相关centos内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复