阿里雲centos7.x 打開80端口(轉)


本文轉自:https://blog.csdn.net/tengqingyong/article/details/82805053

一 :阿里雲centos7.x用iptables打開80端口

1、安裝iptables:yum install iptables-services(阿里雲centos7 默認 是使用的firewall,所以要使用iptables需先安裝)

2、相看filrwall是否關閉:

                                          查看:systemctl status firewalld

 

                     啟動: systemctl start firewalld

                    關閉: systemctl stop firewalld

                   開機禁用  : systemctl disable firewalld

                   開機啟用  : systemctl enable firewalld

3、把端口加入到iptables中(加入之前,可使用iptables -L -n查看端口情況)

       指令:vim /etc/sysconfig/iptables

       

4、重啟iptables:systemctl restart iptables.service(重啟后,使用 iptables -L -n查看)

 

二:centos7.x用firewall打開80端口

1.關閉與開啟防火牆

      啟動:systemctl start firewalld

      關閉: systemctl stop firewalld

2.查看防火牆是否開啟的狀態,以及開放端口的情況

    systemctl status firewalld.service

    firewall-cmd --list-all 

3. 通過以下命令開放http  80 端口

    firewall-cmd  --add-port=80/tcp --permanent

    命令末尾的--permanent表示用久有效,不加這句的話重啟后剛才開放的端口就又失效了 

4 .然后重啟防火牆:

    sudo firewall-cmd --reload

5. 再次查看端口的開放情況:

     firewall-cmd --list-all

     ports:里出現了 80 端口

     

三 OK后,還需在阿里雲控制台上, 添加安全組規則。

     


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM