zoukankan      html  css  js  c++  java
  • Centos 开放80端口

    一、添加规则

    #/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    #/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT

    然后保存:
    #/etc/rc.d/init.d/iptables save

    再查看是否已经有了:
    [root@vcentos ~]# /etc/init.d/iptables status
    Table: filter
    Chain INPUT (policy ACCEPT)
    num target prot opt source destination
    1 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:80
    2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
    3 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0

    Chain FORWARD (policy ACCEPT)
    num target prot opt source destination
    1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0


    二.重启电脑。

    1.CentOS操作系统防火墙默认已经开放了80和22端口

    2.这里应该也可以不重启计算机:
    #/etc/init.d/iptables restart
    防火墙的关闭,关闭其服务即可:

    3.查看防火墙信息:
    #/etc/init.d/iptables status

    4.关闭防火墙服务:
    #/etc/init.d/iptables stop

    三.永久关闭防火墙

    我们也可以永久的关闭防火墙,但是我不建议大家这样做.永久关闭防火墙可以这样:
    #chkconfig –level 35 iptables off
    也可以直接修改
    /etc/sysconfig/iptables
    添加一条
    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT


    来源:http://www.cnblogs.com/cnjava/p/3311950.html

  • 相关阅读:
    Redis 多项目序列化问题
    Java序列化的相关认知
    《Proxy系列专题》:代理模式(静态、JDK、CGLib)
    好文章地址
    @ServletComponentScan
    Spring 自动配置的原理
    B+Tree
    Sentinel
    ThreadPoolUtil
    UUID
  • 原文地址:https://www.cnblogs.com/fengbohello/p/4647011.html
Copyright © 2011-2022 走看看