centos7.1 默认是firewalld,代替了iptables.一些命令比centos6发生了很大的变化。
一、增加http,https到/etc/firewalld/zones/public.xml文件。
<?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="http"/> <service name="ssh"/> <service name="https"/> </zone>
二、重启firewall-cmd --reload
一、把以下代码加入到/etc/nginx/nginx.conf 配置文件中的http.
server{ listen 80 default_server; server_name _; return 404; }
二、重启systemctl restart nginx