gpt4 book ai didi

tomcat - 转发流量从80到8080

转载 作者:行者123 更新时间:2023-11-28 22:04:15 25 4
gpt4 key购买 nike

<分区>

我在 puppet 上安装了 tomcat。它运行在标准的 8080 端口上。 tomcat进程以tomcat用户启动。我想将所有流量从端口 80 重定向到 8080。我的 iptables 设置如下所示:

纳特:

# iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT tcp -- anywhere anywhere multiport dports http /* 099 forward port 80 to 8080 */ redir ports 8080

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

标准 iptables:

# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT icmp -- anywhere anywhere /* 000 accept all icmp */
ACCEPT all -- anywhere anywhere /* 001 accept all to lo interface */
REJECT all -- anywhere loopback/8 /* 002 reject local traffic not on loopback interface */ reject-with icmp-port-unreachable
ACCEPT all -- anywhere anywhere /* 003 accept related established rules */ state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere multiport dports ssh /* 004 accept ssh */
ACCEPT tcp -- anywhere anywhere multiport dports http,https /* 100 allow http and https access */
DROP all -- anywhere anywhere /* 999 drop all */

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

我看到netstat显示tomcat进程正在监听8080端口:

# netstat -tulpn | grep 80
tcp6 0 0 :::8080 :::* LISTEN 16273/java
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 16273/java
tcp6 0 0 :::8009 :::* LISTEN 16273/java

似乎没有任何东西在端口 80 上监听。 telnet 到端口 80 和 8080 hugs 上的那台机器。

如何将所有流量从 80 转发到 8080?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com