连接在SSH隧道中失败

我有一个远程主机上的端口8000上运行的Web服务器。 我从localhostbuild立了一个隧道:

ssh -L 8888:localhost:8000 remotehost 

但是,当我尝试请求本地主机:8888我得到:

  channel 3: open failed: connect failed: Connection refused 

在terminal上。 为什么连接失败? 我应该如何解决它?

听起来好像在localhost:8000的另一端的端口上没有任何东西。 使用netstat来validation是否正在监听。

在你的远程主机上的sshd_config文件中,你有这个吗?

 AllowTcpForwarding yes 

尝试连接到远程主机上的localhost:8000。 可能是在该端口上没有程序运行。