通过http

时间:2018-06-17 17:03:41

标签: nginx centos

在vps上配置nginx,但公共IP或域名未通过http

访问默认index.html

nginx config

server {
    listen       80 default_server;
    server_name  domainname.com;
    root   /usr/share/nginx/html;
    index  index.html;

    location / {
    }
}

1 个答案:

答案 0 :(得分:0)

默认情况下,centos 7防火墙阻塞端口80

需要编辑下一个文件

  

/etc/firewalld/zones/public.xml

添加80端口

<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="ssh"/>
  <service name="dhcpv6-client"/>
  <port protocol="tcp" port="80"/>
</zone>

重新加载防火墙

  

firewall-cmd --reload