本篇文章為大家展示了不能從其他機器訪問RHEL5.5上的Tomcat 6如何使用,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。
在RHEL5上安裝了tomcat6, 啟動之后,本機可以訪問,但從其他機器訪問不了,原來是iptables的問題。
1.環境:
vmware workstation 7.1.2 build-301548
RedHat Enterprise Linux 5.5
apache-tomcat-6.0.30
jdk1.6.0_22
2.問題描述:
在RHEL5上安裝了tomcat6, 啟動之后,本機可以訪問,但從其他機器訪問不了。
3.RHEL5安裝后默認的ittables規則:
[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
4.解決辦法:
刪除當前INPUT鏈上的規則
iptables -F INPUT
增加兩條INPUT鏈上規則,針對tcp的80和8080端口(8080是tomcat的默認端口)
iptables -A INPUT -p tcp -s 0/0 --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 --dport 8080 -j ACCEPT
上述內容就是不能從其他機器訪問RHEL5.5上的Tomcat 6如何使用,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。