如何在我的 VPS 上启动 Nodejs RESTful 服务?

How can I start a Nodejs RESTful Service on my VPS?

我已经完成了这些步骤:

  1. 写一个简单的RESTful服务使用节点。 (在我的本地主机上运行良好。)
  2. 将这些代码推送到 Github(https://github.com/HotHunter/VirginBlog/tree/develop/Server).
  3. 在 Vultr.com 上部署 VPS(CentOS)。 IP: 45.76.212.189
  4. 在我的 VPS 上安装并启动 MongoDB 服务器。
  5. 在我的 VPS.
  6. 上安装最新版本的节点
  7. 将我的 RESTful 代码克隆到我的 VPS。
  8. 使用命令 'node app.js' 启动 RESTful 服务。

问题:

发送请求后我没有得到任何响应。(但它在我的本地主机上工作正常。)

如何正确启动 RESTful 服务?

其实是防火墙屏蔽了请求

解决方法(CentOS 7):

  1. 查看防火墙是否屏蔽端口,列出开放端口:

    $ firewall-cmd --list-all

  2. 如果列表不包含您的服务需要的端口,请使用以下命令打开它:

    $ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

    $ sudo firewall-cmd --reload

More details, reference to this post: http://ask.xmodulo.com/open-port-firewall-centos-rhel.html