Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何创建SSH隧道来访问托管Web服务器的远程计算机_Ssh_Webserver_Vps_Tunnel - Fatal编程技术网

如何创建SSH隧道来访问托管Web服务器的远程计算机

如何创建SSH隧道来访问托管Web服务器的远程计算机,ssh,webserver,vps,tunnel,Ssh,Webserver,Vps,Tunnel,我的情况如下 我有一个带有公共静态地址的VPS,我可以通过SSH连接到它。 我还有一个raspberry pi在家里的80端口上运行Web服务器 我的Pi在引导时打开一个到VPS的隧道,这样我就可以用ssh从VPS到Pi 如何打开一个隧道,以便通过键入VPS的URL(例如)从浏览器访问PI上的Web服务器 我尝试使用以下命令从pi打开隧道: ssh-vps-R 8080:localhost:80 我还试图从我的副总裁那里打开一个隧道 ssh pi-L 8080:pi:80如果希望从外部访问端口(

我的情况如下

我有一个带有公共静态地址的VPS,我可以通过SSH连接到它。 我还有一个raspberry pi在家里的80端口上运行Web服务器

我的Pi在引导时打开一个到VPS的隧道,这样我就可以用ssh从VPS到Pi

如何打开一个隧道,以便通过键入VPS的URL(例如)从浏览器访问PI上的Web服务器

我尝试使用以下命令从pi打开隧道:
ssh-vps-R 8080:localhost:80

我还试图从我的副总裁那里打开一个隧道
ssh pi-L 8080:pi:80

如果希望从外部访问端口(
myserver.com:8080
),还需要指定远程绑定地址:

ssh vps -R myserver.com:8080:localhost:80


如果您设置了
网关端口yes
,则该选项适用于您,您使用
PermitOpen
没有任何限制的转发,您已经重新启动了
sshd
服务器。

我还在/etc/ssh/sshd\u config中的VPS配置中添加了以下行:
GatewayPorts yes
So from my PI Itype@BenD你打什么?抱歉我开始写东西了,我误按了回车键,就看到了。真的@Jakuje真管用!谢谢你的帮助:)
ssh vps -R server_ip:8080:localhost:80