javascript - Node JS + ExpressJS - net::ERR_CONNECTION_RESET?

标签 javascript node.js express

我有一个基于 ExpressJS 和 NodeJS 构建的应用程序。我们将其托管在 Linode 服务器上。该应用程序在端口 3000 上提供服务。

该应用程序已经运行了一年,但最近我们不断收到连接错误。有时没关系。但大多数时候不是。

我们得到的错误通常是:

GET http://0.0.0.0:3000/stylesheets/bootstrap-tagsinput.css net::ERR_CONNECTION_RESET 0.0.0.0/:7

GET http://0.0.0.0:3000/stylesheets/jasny-bootstrap/jasny-bootstrap.css net::ERR_CONNECTION_RESET 0.0.0.0/:7

GET http://0.0.0.0:3000/javascripts/jquery.min.js net::ERR_CONNECTION_RESET 0.0.0.0/:63 

GET http://0.0.0.0:3000/stylesheets/fonts.css net::ERR_CONNECTION_REFUSED 0.0.0.0/:63

GET http://0.0.0.0:3000/javascripts/bootstrap.min.js net::ERR_CONNECTION_REFUSED 0.0.0.0/:64 

GET http://0.0.0.0:3000/javascripts/bootstrap-tagsinput.js net::ERR_CONNECTION_REFUSED 0.0.0.0/:65 

GET http://0.0.0.0:3000/javascripts/jasny-bootstrap/jasny-bootstrap.js net::ERR_CONNECTION_REFUSED 0.0.0.0/:65

GET http://0.0.0.0:3000/vendors/bootstrap-validator/dist/validator.min.js net::ERR_CONNECTION_REFUSED 0.0.0.0/:66 

GET http://0.0.0.0:3000/javascripts/common.js net::ERR_CONNECTION_REFUSED 0.0.0.0/:67 

GET http://0.0.0.0:3000/fonts/glyphicons-halflings-regular.woff2 net::ERR_CONNECTION_REFUSED 0.0.0.0/:64 

GET http://0.0.0.0:3000/images/pollen-dustbox-transparent.png net::ERR_CONNECTION_REFUSED 0.0.0.0/:52 

GET http://0.0.0.0:3000/images/carbon-transparent.png net::ERR_CONNECTION_REFUSED 0.0.0.0/:64 

有时浏览器只会说:

This site can't be reached.

知道是什么原因造成的吗?我该如何解决这个问题?

请注意,我以0.0.0.0 为例。不确定我是否应该分享我们的应用程序 IP 地址。不想被黑客攻击!

编辑:

当我运行 netstat 时,我没有看到端口 3000 在列表中:

$ sudo netstat -tulpn

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      15065/mongod
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      3262/systemd-resolv
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3265/sshd
tcp        0      0 0.0.0.0:3838            0.0.0.0:*               LISTEN      3267/shiny-server
tcp6       0      0 :::5355                 :::*                    LISTEN      3262/systemd-resolv
tcp6       0      0 :::80                   :::*                    LISTEN      1514/httpd
tcp6       0      0 :::22                   :::*                    LISTEN      3265/sshd
udp        0      0 0.0.0.0:5355            0.0.0.0:*                           3262/systemd-resolv
udp        0      0 0.0.0.0:68              0.0.0.0:*                           3260/dhcpcd
udp6       0      0 :::5355                 :::*                                3262/systemd-resolv

是Linode服务器的问题还是应用层的错误?有什么想法吗?

最佳答案

当我在我的 Windows 机器上的“安全”(brandmauer 或它的调用方式)中禁用 80 端口时,我遇到了同样的错误。 启用后 - 一切正常。

当您使用 3000 端口时 - 检查它是否已启用。

我在路由器上遇到的另一个问题是相同的(在我的 wify 路由器上我必须设置我想要 80 端口将请求转发到我的 pc 80 端口)。如果您也在使用路由器检查该配置。

另外最好自己做nginx服务器,反向代理到3000端口,可以查查网上的手册。

关于javascript - Node JS + ExpressJS - net::ERR_CONNECTION_RESET?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42934057/

相关文章:

node.js - 尝试为 REST API 制定 Mongoose 关系编码

javascript - 当有人像 facebook 广告一样滚动我们的页面时,如何创建固定的 div?

javascript - Visual Studio 2015 中的 AngularJS 智能感知

mysql - 从 Node.js 将 Json 存储到 MySQL 数据库中

javascript - Node.JS 中的异步

node.js - 无法使用 systemctl 永远启动进程

javascript - KnockoutJS - 数据绑定(bind)错误

javascript - 在模块中查找函数

javascript - Javascript 中的 session 和 Cookie 未存储(不起作用)

node.js - 如何呈现子文件夹中的 HTML 文件?