繁体   English   中英

CentO中的AWS中的node.js应用程序部署不起作用

[英]node.js application deployment in aws in CentOs not working

当我在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上运行

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

1)入站规则是
HTTP-任何地方
SSH-任何地方
自定义TCP规则(PORT-3000)-任何位置
HTTPS-任何地方
自定义UDP规则(PORT-3000)-任何位置
2)出站规则是
所有流量| 所有协议|所有端口| 任何地方

任何帮助表示赞赏。 非常感谢。

问题已解决,甚至可以按以下方式设置入站规则:
HTTP-任何地方
SSH-任何地方
自定义TCP规则(PORT-3000)-任何位置
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/教程/如何设置基本iptables-firewall-on-centos-6以允许防火墙中的特定端口

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM