怎么从局域网上访问node-red
时间: 2023-05-09 22:03:15 浏览: 684
要从局域网上访问node-red,需要遵循以下步骤:
1. 确定本地IP地址:在命令提示符或终端中输入`ipconfig`(Windows系统)或`ifconfig`(Linux或MacOS系统)来查看本地IP地址。
2. 在node-red的设置文件中启用远程访问选项:在node-red的工作目录中找到`settings.js`文件,在其中寻找以下行:
```
// The following property can be used to enable HTTPS (no SSL) on the editor
//server. See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
// for details on its contents. The cert and key fields can either contain
//the content of the certificate or the path to the file. Note that this
//HTTPS settings are ignored if running the server through an existing
//HTTPS proxy such as nginx or HAProxy.
//https: {
// cert: "/path/to/cert.pem",
// key: "/path/to/key.pem"
//},
```
将其中的`https:`选项取消注释并修改如下:
```
https: {
key: require("fs").readFileSync("client-key.pem"),
cert: require("fs").readFileSync("client-cert.pem")
},
```
(其中的`client-key.pem`和`client-cert.pem`是你的服务器证书和密钥文件的名称)。
3. 开启node-red服务:在命令提示符或终端中输入以下命令以启动node-red服务:
```
node-red
```
4. 访问node-red:在浏览器地址栏中输入`http://本地IP地址:1880`(其中“本地IP地址”是第一步中查看到的地址),然后按下回车键即可。
以上就是从局域网上访问node-red的步骤。需要注意的是,如果你的路由器启用了防火墙功能,可能需要手动设置允许访问node-red的端口号(默认为1880)。
阅读全文
相关推荐

















