我不是服务器pipe理员,但由于我正在做一些Facebook Connect编程,我需要一个面向公众的80端口URL来转发到我的本地开发环境。 所以我有一个基于Centos的Web服务器,并且已经停止了httpd(和nginx)服务,但是当我尝试从80端口进行SSH隧道时,它不起作用。 它可以工作在任何其他端口,我可以告诉。
这里基本上是我正在运行的命令:
ssh -v -p 22 -nNT4 -R *:80:localhost:3000 username@http://myurl.com
服务器上的80端口是以什么方式绑定的? 我必须释放它或什么? 我环顾四周,看到它可能与我的sshd_config中的GatewayPorts设置有关 – 目前设置为“Yes”。
在此先感谢您的任何build议!
卡梅伦
作为普通(非root)用户,您不能绑定到端口<1024。
使用“netstat -lnp | grep”:80“来查看是否有任何东西在端口80上侦听。
正如Bill Weiss所提到的,您需要以root身份login到远程服务器,以便您有权限绑定到1024以下的端口。
此外,您需要在面向公众服务器的sshd_config中启用GatewayPorts。 没有这个,sshd将只允许它绑定到回送地址。
GatewayPorts指定是否允许远程主机连接到为客户端转发的端口。 默认情况下,sshd将远程端口转发绑定到回送地址。 这可以防止其他远程主机连接到转发的端口。 GatewayPorts可用于指定sshd应允许远程端口转发绑定到非回送地址,从而允许其他主机连接。 该参数可能
no'' to force remote port forward- ings to be available to the local host only,强制远程端口转发no'' to force remote port forward- ings to be available to the local host only,是强制远程端口转发绑定到通配符地址或clientspecified'' to allow the client to select the address to which the forwarding is bound. The default isclientspecified'' to allow the client to select the address to which the forwarding is bound. The default is不是“”。
另外,你的例子中的' http://www.myurl.com/ '也应该只是主机名(没有http://)
你可以运行nc -l 80吗? 如果有任何其他使用的端口,你应该得到“NC:地址已经在使用”