尝试建立远程 ssh 端口转发:
在我的远程主机上,/etc/ssh/sshd_config
客户端指定的网关端口
在我的本地计算机上:
ssh -g -R 1234:0.0.0.0:8000 me@my-remote-host
Run Code Online (Sandbox Code Playgroud)
通过调试,我们可以阅读:
debug1: Authentication succeeded (publickey).
Authenticated to s1.bux.fr ([178.32.223.76]:22).
debug1: Remote connections from LOCALHOST:1234 forwarded to local address 0.0.0.0:8000
debug2: fd 3 setting TCP_NODELAY
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: remote forward success for: listen 1234, connect 0.0.0.0:8000
debug1: All remote forwarding requests processed
Run Code Online (Sandbox Code Playgroud)
在远程主机上,我们可以联系 1234 端口(WSGIServer/0.2 CPython/3.4.3是本地机器的 8000 端口):
# http :1234
HTTP/1.0 302 Found
Content-Type: text/html; charset=utf-8
Date: Wed, 19 Oct 2016 13:26:00 …Run Code Online (Sandbox Code Playgroud)