数字海洋上的访问节点应用程序 - 无法访问此网站 [英] Access node app on digital ocean - This site can't be reached

查看:230
本文介绍了数字海洋上的访问节点应用程序 - 无法访问此网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法访问我的数字海洋节点js应用程序。我已经SSH'ed,从Git克隆我的Node应用程序,已安装npm,并成功启动了应用程序的液滴,但我得到错误


此网站无法访问




Digital Ocean文档说,只需转到<您的网站的ip>:< port> ,即可访问您面向公众的网站:





我通过转到 67.205.185.63:9000 / (我的应用程序在9000端口上运行,如您所见):


root @ nodejs-512mb-nyc1-01:〜/ demos#npm start



live-demos@1.0.0 start / root / demos



节点app.js



演示正在监听端口9000


如何访问我的节点应用程序?




  var express = require('express'); 
var bodyParser = require('body-parser');

var app = express();
var port = process.env.PORT || 9000;


$ b app.listen(port,function(){
console.log('Demos正在监听端口'+ port);
});


解决方案

一些数字海洋飞沫(主要是一键式应用程序)随ufw防火墙一起安装,默认情况下所有端口除22,80,和443被阻止。



检查ufw是否安装以及哪些端口被阻止/打开:



sudo ufw status



输出:

 执行从
- ------ ----
22 LIMIT Anywhere
80 ALLOW Anywhere $ b $ (v6)
80(v6)允许任何地方(v6)
443(v6)允许任何地点这里(v6)

允许在端口9000上执行流量操作:

  sudo ufw允许9000 / tcp 


I am unable to access my digital ocean node js app. I've already SSH'ed in, cloned my Node app from Git, npm installed, and successfully started the app on the droplet, yet I get error

This site can't be reached

Digital Ocean docs say you can access your publicly facing website simply by going to <your website's ip>:<port>:

I did this by going to 67.205.185.63:9000/ (my app is running on port 9000 as you can see):

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

How else should I be accessing my node app?


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);
});

解决方案

Some Digital Ocean droplets (mainly one-click apps) come with ufw firewall installed and by default all ports except for 22, 80, and 443 are blocked.

To check if ufw is installed and which ports are blocked/open do:

sudo ufw status

Output:

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)

To allow traffic on port 9000 do:

sudo ufw allow 9000/tcp

这篇关于数字海洋上的访问节点应用程序 - 无法访问此网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆