要想重啟後也生效LINUX防火牆配置

2022-02-21 02:37:46 字數 597 閱讀 1542

新配置的一台伺服器,安裝的是centos6.3系統,在安裝完lnmp之後,發現nginx程序存在,且php解析正常,但是用分配的獨立ip去訪問的時候發現無法訪問。

查了下網上的資料,發現可能是linux防火牆iptables導致nginx不能訪問。我們訪問乙個**,一般用的是80埠,那麼這個問題的原因可能就是80埠的訪問被攔截了。檢視/etc/sysconfig/iptables檔案,發現裡面沒有80埠的配置規則,需要修改下iptables。

在root許可權下執行:

iptables -a input -p tcp --dport 80 -j accept

然後執行(即時生效,重啟失效):

service iptables stop

service iptables start

要想重啟後也生效,則執行:

chkconfig iptabels on

chkconfig iptabels off

linux防火牆編輯與重啟

1.在 etc sysconfig iptables裡新增 vi etc sysconfig iptables 新增一條配置規則,如要想開放8080的埠,如下所示 a rh firewall 1 input m state state new m tcp p tcp dport 8080 j acc...

Linux 防火牆編輯重啟命令

1.在 etc sysconfig iptables裡新增 vi etc sysconfig iptables 新增一條配置規則,如要想開放8080的埠,如下所示 a rh firewall 1 input m state state new m tcp p tcp dport 8080 j acc...

Linux關閉 重啟防火牆命令

外部經常因防火牆問題無法訪問linux中的埠,就需要放通ip或徹底關閉防火牆 檢視防火狀態 systemctl status firewalld service iptables status暫時關閉防火牆 systemctl stop firewalld service iptables stop...