我有以下 iptables。但现在我需要允许该服务器中的任何人(如果他有唯一的网址):www.example.com/IamEncodedencodedencodedencodedencodedencoded_Allow_Me
$ yum install iptables-services
$ cat /etc/sysconfig/iptables
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# 1 ############ My office ##########
-A INPUT -s 217.1.2.3 -j ACCEPT
-A INPUT -s 82.1.2.3 -j ACCEPT
############# My office END ######
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
# 2 ########### Service center ############
-A INPUT -s 18.16.0.0/16 -j ACCEPT
############ Service center END ############
-A INPUT -j DROP
COMMIT
$ systemctl restart iptables
$ systemctl reload iptables
编辑:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -s 217.1.2.3 -j ACCEPT
-A INPUT -s 82.1.2.3 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -s 18.16.0.0/16 -j ACCEPT
-A INPUT -j DROP
-A INPUT -p tcp --dport 80 -j ACCEPT
COMMIT
答案1
如果您想允许从浏览器访问并且您正在使用阿帕奇作为网络服务器,那么您可以添加以下行阿帕奇配置并启动服务。
#Deny the access to everything first
<Location />
Order Deny,Allow
Deny from All
</Location>
# then allow access to specific URL
<Location /test.html>
Order Allow,Deny
Allow from All
</Location>
如果是这种情况,这个问题之前已经回答过这里。