Node.js:将 repl 挂接到远程节点服务器 [英] Node.js: Hooking repl to a remote node server

查看:62
本文介绍了Node.js:将 repl 挂接到远程节点服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个在 mysite.com 上运行的节点服务器.有没有办法设置该服务器,以便我可以使用 node 的 repl api从我的本地机器安全连接到它?

Let's say I have a node server running at mysite.com. Is there a way to set up that server so that I can use node's repl api to securely connect to it from my local machine?

推荐答案

好吧,如果你使用这个例子:

Well, if you used this example:

net.createServer(function (socket) {
  repl.start("node via TCP socket> ", socket);
}).listen(5001, "localhost");

并且对那个端口 5001 设置了防火墙,您应该能够使用 ssh 安全地连接到它:

And firewalled that port 5001, you should be able to securely connect to it using ssh:

ssh user@host nc localhost 5001

在这种情况下,安全性取决于您的防火墙和 ssh.

In this case, the security relies on your firewall, and ssh.

这篇关于Node.js:将 repl 挂接到远程节点服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆