首页 > 其他 > 详细

CentOS7安装Nginx

时间:2019-12-14 14:48:16      阅读:103      评论:0      收藏:0      [点我收藏+]

一、关闭selinux: $ vi /etc/selinux/config

改为disabled.

然后重启服务器。

二、安装Nginx: $ yum -y install nginx

如果出现:No package nginx available

参考:https://www.cnblogs.com/maxwell-xu/p/8000458.html

使用:$ rpm -qa | grep nginx

查看nginx是否成功安装.

启动nginx:$ systemctl start nginx

使Nginx在系统引导时自动启动:$ systemctl enable nginx.

检测nginx的当前状态:$ systemctl status nginx

检测firewalld(CentOS7中防火墙从iptables变为firewalld)状态:$ systemctl status firewalld.

如果firewalld没有启用那么需要将其启用。

打开端口80:$ firewall-cmd --zone=public --add-port=80/tcp --permanent

重启防火墙:$ systemctl restart firewalld.

如果想想在Nginx上启用HTTPS,那么还需要代开443端口:

$:firewall-cmd --zone=public --add-port=443/tcp --permanent

使用:$ netstat -lntp 查看端口是否被分配给了Nginx.

使用:$curl 127.0.0.1:80看能否访问。

使用其它机器的浏览器访问:http:ip

CentOS7安装Nginx

原文:https://www.cnblogs.com/gufengchen/p/12038981.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!