本文介绍了无法访问AWS Linux上托管的NodeJs网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在AWS Red Hat Linux上托管了NodeJs网站,但可以从外部访问它. 虽然当我从腻子运行我的nodejs服务器时,它运行得很好.
I hosted my NodeJs website on AWS Red Hat Linux but it's accessible from outside. although when i run my nodejs server from putty, it was running just fine.
下面是我在nodejs中创建服务器的代码.我正在使用带有玉石的Express框架.
below is my server creation code in nodejs.I'm using express framework with jade.
app.listen(80, function () { console.log('Server starts on port: ' + 80); });我还从AWS控制台打开了所有流量,并尝试了其他端口.
I have opened all traffic from AWS console also and tried other ports as well.
ps -ef | grep node says:-
和app.log说:-
and app.log says:-
uncaughtException: Error: listen EADDRINUSE Server starts on port: 80推荐答案
app.listen(80,"0.0.0.0", function () { console.log('Server starts on port: ' + 80); });``
应始终确保您的应用可以通过网络访问,例如"0.0.0.0"参数enter code here
it should work always make sure your app is accessible over the network eg "0.0.0.0" parameterenter code here
更多推荐
无法访问AWS Linux上托管的NodeJs网站
发布评论