阅读背景:

CentOs中的aws中的node.js应用程序部署无法正常工作

来源:互联网 

when i run a node.js application in CentOs 6.5 in AWS

当我在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" );

it runs and shows this on console:
Server is running on 3000

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

but when i open my browser and run the public DNS given by amazon :https://ec2-54-152-55-189.compute-1.amazonaws.com:3000/, it shows webpage not available ,but in terminal of CentOs in aws ,when I run command :curl https://ec2-54-152-55-189.compute-1.amazonaws.com:3000/ it shows Hellow world from AWS!

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

1)Inbound rules are
HTTP -- AnyWhere
SSH -- AnyWhere
CUSTOM TCP RULE (PORT-3000)-- AnyWhere
HTTPS-- AnyWhere
CUSTOM UDP RULE (PORT-3000)-- AnyWhere
2)Outbound Rules are
All traffic| All protocol |ALL port| AnyWhere

1)入站规则是HTTP - AnyWhere SSH - AnyWhere CUSTOM TCP RULE(PORT-3000) - AnyWhere HTTPS-- AnyWhere CUSTOM UDP RULE(PORT-3000) - AnyWhere 2)出站规则是所有流量|所有协议| ALL端口|随地

Any help is appreciated. Thanks a lot.

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

1 个解决方案

#1


0  

the issue is resolved ,even setting inbound rules as follows:
HTTP -- AnyWhere
SSH -- AnyWhere
CUSTOM TCP RULE (PORT-3000)-- AnyWhere
HTTPS-- AnyWhere
CUSTOM UDP RULE (PORT-3000)-- AnyWhere

问题得到解决,甚至设置入站规则如下:HTTP - AnyWhere SSH - AnyWhere CUSTOM TCP RULE(PORT-3000) - AnyWhere HTTPS-- AnyWhere CUSTOM UDP RULE(PORT-3000) - AnyWhere

in centOS 6.5 instance ,firewall was not allowing any connection from port (HTTP)80,(CUSTOM)3000,(HTTPS)443.Therefore,i made allow the required port no. in iptables see: https://www.cyberciti.biz/faq/howto-rhel-linux-open-port-using-iptables/ to edit the iptables and restarted the firewall https://www.digitalocean.com/community/tutorials/how-to-set-up-a-basic-iptables-firewall-on-centos-6 to allow particular port in firewall

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


分享到: