[英]Using NOIP with RPI node.js server
Im no expert in networks so sorry if something seems stupid. 我不是网络专家,如果感到有些愚蠢,对不起。
I'm having a problem connecting to RPI node.js server located in my home externally. 我在连接外部位于我家中的RPI node.js服务器时遇到问题。 I used NO-IP and configured it on router with specific host-name.
我使用了NO-IP并将其配置在具有特定主机名的路由器上。 I have port forwarded to 8888 port.
我已将端口转发到8888端口。
var express = require("express");
var app = express();
var http = require("http").Server(app);
var io = require('socket.io')(http);
var path = require('path');
http.listen(8888, "0.0.0.0");
/*app.use(function (req, res, next){
res.setHeader('Access-Control-Allow-Origin', 'http://hostname:port');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.setHeader('Access-Control-Allow-Credentials', true);
next();
});*/
app.use(express.static(path.join(__dirname, '/')));
app.get("/home",function(req,res,next){
res.sendFile(path.join(__dirname + "/index.html"));
});
console.log("server ubi jeza");
If I try to connect to http://hostanme.org it connect to my router. 如果我尝试连接到http://hostanme.org,它将连接到我的路由器。 If I try connect to http://hostanme.org:8888 it times-off.
如果我尝试连接到http://hostanme.org:8888,它会关闭。
Port forward check works fine and says that port 8888 is working when I run the server. 端口转发检查工作正常,并说当我运行服务器时端口8888正在工作。 When server is not running it say that connection is closed.
服务器未运行时,说连接已关闭。
I also tried with sudo nano /etc/sysctl.conf
and net.ipv4.ip_forward=1
but it doesn't work ither. 我也尝试了
sudo nano /etc/sysctl.conf
和net.ipv4.ip_forward=1
但是在它上不起作用。
Am I doing something wrong? 难道我做错了什么?
I can access page from outside world. 我可以从外界访问页面。 When I'm on local network I can not access it with external IP.
当我在本地网络上时,无法使用外部IP访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.