[英]How to access meteor app from outside without passing through NginX?
I am hosting a meteor app on an Ubunu Linux machine. 我正在Ubunu Linux机器上托管流星应用程序。 The app is listening on port
3000
. 该应用程序正在侦听端口
3000
。 If I use a webserver, like NginX and forwards the HTTP requests from port 80
to 3000
I can browse to the server from the outside and see reach the app. 如果我使用Web服务器(例如NginX)并将HTTP请求从端口
80
转发到3000
,则可以从外部浏览到服务器并查看到达应用程序。 However, when I try to access the app directly at port 3000
, ie browse http://myhost:3000 it just tries to connect and nothing happens. 但是,当我尝试直接在端口
3000
上访问该应用程序时,即浏览http:// myhost:3000,它只是尝试连接而没有任何反应。
I have made sure that all firewalls are down and that the app is listening on all interfaces, ie 0.0.0.0:3000
, so that is not the issue. 我确保所有防火墙都关闭并且该应用程序正在所有接口上监听,即
0.0.0.0:3000
,所以这不是问题。
To verify that port was actually reachable, I created a simple node js webserver: 为了验证端口是否实际可用,我创建了一个简单的节点js Web服务器:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('Hello World!');
res.end();
}).listen(3000);
Now browsing to the the sever, I can see "Hello World!"
现在浏览到服务器,我可以看到
"Hello World!"
. 。 So obviously this works so why I can not reach meteor has nothing to do with firewalls or unopened ports.
所以很显然,这行得通,因此为什么我无法到达流星与防火墙或未打开的端口无关。
Thus it seems that there is something strange when trying to access a meteor app directly at port 3000. But why? 因此,当尝试直接在端口3000上访问流星应用程序时,似乎有些奇怪。但是为什么呢? I use the following environment variables:
我使用以下环境变量:
export MONGO_URL=mongodb://localhost:27017/meteor
export HOST=myhost
export PORT=3000
export ROOT_URL=http://myhost
So what am I missing? 那我想念什么呢? Ports are open and I can see that the
node
process instance is listening on port 3000
when I run netstat -tulpan
端口打开,运行
netstat -tulpan
时,我可以看到node
进程实例正在侦听端口3000
I was using the force-ssl
meteor package which makes a redirect back to the ROOT_URL
without port number. 我使用的是
force-ssl
流星软件包,该ROOT_URL
无需端口号即可重定向回ROOT_URL
。 So solution is to remove the package to make it work with a custom port. 因此,解决方案是删除软件包以使其与自定义端口一起使用。
I was discussing the solution on the meteor forum where I got the solution: https://forums.meteor.com/t/can-not-access-meteor-app-without-passing-through-nginx-server/40739/11 我正在获得解决方案的流星论坛上讨论该解决方案: https : //forums.meteor.com/t/can-not-access-meteor-app-without-passing-through-nginx-server/40739/11
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.