内容简介:翻译自:https://stackoverflow.com/questions/43990604/access-node-app-on-digital-ocean-this-site-cant-be-reached
克隆了我的Node应用程序,安装了npm,并在Droplet上成功启动了应用程序,但是我收到了错误
This site can’t be reached
数字海洋文档说,只需转到 :<port>:即可访问面向公众的网站: 您网站的ip>
我这样做是通过转到67.205.185.63:9000/(我的应用程序在端口9000上运行,如您所见):
root@nodejs-512mb-nyc1-01:~/demos# npm start live-demos@1.0.0 start /root/demos node app.js Demos is listening on port 9000
我还应该如何访问我的节点应用程序?
var express = require('express'); var bodyParser = require('body-parser'); var app = express(); var port = process.env.PORT || 9000; ... app.listen(port, function () { console.log('Demos is listening on port ' + port); });
)安装了ufw防火墙,默认情况下除了22,80和443之外的所有端口都被阻止.
要检查是否已安装ufw以及阻止/打开了哪些端口,请执行以下操作:
sudo ufw status
输出:
To Action From -- ------ ---- 22 LIMIT Anywhere 80 ALLOW Anywhere 443 ALLOW Anywhere 22 (v6) LIMIT Anywhere (v6) 80 (v6) ALLOW Anywhere (v6) 443 (v6) ALLOW Anywhere (v6)
要允许端口9000上的流量执行:
sudo ufw allow 9000/tcp
翻译自:https://stackoverflow.com/questions/43990604/access-node-app-on-digital-ocean-this-site-cant-be-reached
以上所述就是小编给大家介绍的《node.js – 数字海洋上的访问节点应用程序 – 无法访问此站点》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- PHP的SimpleXML遍历所有子元素及访问特定节点元素和属性
- 如何通过Geth、Node.js和UNIX/PHP访问以太坊节点
- xml创建节点(根节点、子节点)
- Vultr VPS 节点选择方法 | 各节点延迟一览
- 1.19 JQuery2:节点插入与节点选取
- POC分布式节点算法机制下的超级节点计划
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Impractical Python Projects
Lee Vaughan / No Starch Press / 2018-11 / USD 29.95
Impractical Python Projects picks up where the complete beginner books leave off, expanding on existing concepts and introducing new tools that you’ll use every day. And to keep things interesting, ea......一起来看看 《Impractical Python Projects》 这本书的介绍吧!