IPTABLES - 将 80 转发到 8080 到 vagrant 的 apache

IPTABLES - 将 80 转发到 8080 到 vagrant 的 apache

我尝试使用 IPTABLES 将我的 80 访问转发到 8080,但没有成功,然后我读到了这篇文章回答

最后它对我来说是有效的,在我尝试了所有的 IPTABLES 配置之后,这个命令成功了。

sudo ssh -gL 80:127.0.0.1:8080 localhost

这个命令到底起什么作用?

答案1

指挥sudo ssh -gL 80:127.0.0.1:8080 localhost

option -g - Allows remote hosts to connect to local forwarded ports
option -L - [bind_address:]port:host:hostport
             Specifies that the given port on the local (client) host is to be
             forwarded to the given host and port on the remote side.  This
             works by allocating a socket to listen to port on the local side,
             optionally bound to the specified bind_address.  Whenever a
             connection is made to this port, the connection is forwarded over
             the secure channel, and a connection is made to host port
             hostport from the remote machine.  Port forwardings can also be
             specified in the configuration file.  

来自端口 80 的流量重定向到本地主机的端口 8080

相关内容