CentOS iptables防火牆配置方法

來源:互聯網
上載者:User

centos,安裝完LNMP之後發現網頁80連接埠無法訪問,對於CentOS系統不是很懂,但玩過的VPS倒也不少了,還第一次碰到這樣的問題。
靜下心來仔細想想,會不會是防火牆的原因呢?通過從度娘哪裡學到的查看、配置iptables方法成功解決問題,下面記錄一下幾個命令方便以後查看。
[root@centoscn.com ~]#/etc/init.d/iptables status #查看iptables防火牆配置資訊 (貌似還可以查看防火牆是否開啟)
[root@centoscn.com ~]#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #增加80連接埠允許存取
[root@centoscn.com ~]#service iptables save #儲存配置資訊
[root@centoscn.com ~]#service iptables restart/start/stop #iptables防火牆服務重啟/開啟/關閉
[root@centoscn.com ~]#/etc/init.d/iptables stop #關閉 CentOs iptables防火牆
[root@centoscn.com ~]#chkconfig –level 35 iptables off #永久關閉 CentOs iptables防火牆 取消CentOs iptables防火牆自動啟動
切記在增加完防火牆規則後需要做 service iptables save 儲存操作。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.