【问题标题】:node.js application deployment in aws in CentOs not working在 CentO 中的 aws 中的 node.js 应用程序部署不起作用
【发布时间】:2016-02-18 12:18:14
【问题描述】:

当我在 AWS 的 CentOs 6.5 中运行 node.js 应用程序时

var sys = require( "sys" );
var http = require( "http" );
// Create our HTTP server.
var server = http.createServer(
function( request, response ){
// Create a SUPER SIMPLE response.
response.writeHead( 200, {"content-type": "text/plain"} );
response.write( "Hellow world from AWS!\n" );
response.end();
}
);
// Point the HTTP server to port 8080.
server.listen( 3000 );
// For logging....
console.log( "Server is running on 3000" );

它运行并在控制台上显示:
服务器在 3000 上运行

但是当我打开浏览器并运行 亚马逊提供的公共 DNS :http://ec2-54-152-55-189.compute-1.amazonaws.com:3000/,它显示网页不可用,但在aws的CentOs终端中,当我运行命令时:curl http://ec2-54-152-55-189.compute-1.amazonaws.com:3000/它显示 来自 AWS 的 Hellow 世界!

1)入站规则是
HTTP -- 随处可见
SSH -- 随时随地
自定义 TCP 规则 (PORT-3000)-- AnyWhere
HTTPS——随处可见
自定义 UDP 规则 (PORT-3000)-- AnyWhere
2)出站规则是
所有流量|所有协议|所有端口|随处可见

感谢任何帮助。非常感谢。

【问题讨论】:

标签: javascript linux node.js amazon-ec2 centos


【解决方案1】:

问题已解决,即使设置入站规则如下:
HTTP -- 随处可见
SSH -- 随时随地
自定义 TCP 规则 (PORT-3000)-- AnyWhere
HTTPS——随处可见
自定义 UDP 规则 (PORT-3000)-- 任何地方

在centOS 6.5实例中,防火墙不允许来自端口(HTTP)80,(CUSTOM)3000,(HTTPS)443的任何连接。因此,我允许所需的端口号。在 iptables 中 看: http://www.cyberciti.biz/faq/howto-rhel-linux-open-port-using-iptables/ 编辑 iptables 并重新启动防火墙 https://www.digitalocean.com/community/tutorials/how-to-set-up-a-basic-iptables-firewall-on-centos-6 允许防火墙中的特定端口

【讨论】:

    猜你喜欢
    • 2014-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多