内容简介:翻译自: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 – 数字海洋上的访问节点应用程序 – 无法访问此站点》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
ActionScript 3.0 Cookbook
Joey Lott、Darron Schall、Keith Peters / Adobe Dev Library / 2006-10-11 / GBP 28.50
Well before Ajax and Microsoft's Windows Presentation Foundation hit the scene, Macromedia offered the first method for building web pages with the responsiveness and functionality of desktop programs......一起来看看 《ActionScript 3.0 Cookbook》 这本书的介绍吧!