无法访问AWS Linux上托管的NodeJs网站

编程入门 行业动态 更新时间:2024-10-27 20:37:15
本文介绍了无法访问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网站

本文发布于:2023-11-01 22:50:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550635.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法访问   网站   Linux   AWS   NodeJs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!