如何修改iptables,以便在服务器上访问端口

当我做

curl --insecure https://localhost/svn 

从我的Linux机器,我可以看到它正在返回一些数据

但是,当我在同一个networking,例如另一台机器上运行curl

 curl --insecure https://<serverip>/svn 

我得到一个错误curl: (7) couldn't connect to host

即使我可以运行其他东西,如curl http://<serverip>:8080/curl http://<serverip>:9090/

有什么我可以用iptables做这个工作或别的东西吗?

这是我的iptables的样子:

 # iptables -L -n --line-numbers Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080 /* Tomcat Server port */ 6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:9090 /* Tomcat Server port */ 7 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) num target prot opt source destination 1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) num target prot opt source destination 

打开https的默认端口443

 iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT 

注 – 我很重要。 如果那个作品使用

 service iptables save 

更新/etc/sysconfig/iptables

有时selinux可能会阻止curl请求。 您应该检查您的selinuxconfiguration,它处于宽容模式或禁用。