aws ec2 public ip 根本不工作

aws ec2 public ip not at all working

我对 AWS 还很陌生。成功启动 EC2 windows 2012 r2 实例,我可以通过远程桌面服务登录。安装了一个 nodejs 应用程序,它在 localhost:80 上成功 运行。但是,问题出在 public ip 上。我尝试了很多发布的解决方案,例如添加入站安全规则等...我什至终止了实例并重新启动了一个新实例,但没有用。

服务器详细信息: AWS EC2:Windows 2012 R2

每当我尝试通过 public dns 访问时,它都会显示 "webpage not availabe"。我的 public ip 是 http://ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com/

以下是 ping 结果:

C:\Users\srujan>ping ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com

Pinging ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com [54.169.173.68] with 32 bytes of data:
Reply from 54.169.173.68: bytes=32 time=51ms TTL=118
Reply from 54.169.173.68: bytes=32 time=51ms TTL=118
Reply from 54.169.173.68: bytes=32 time=49ms TTL=118
Reply from 54.169.173.68: bytes=32 time=43ms TTL=118

Ping statistics for 54.169.173.68:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 43ms, Maximum = 51ms, Average = 48ms

ping 结果显示什么? public ip 是否正常工作?

请告诉我解决方法。我已经尝试了好几个小时,却束手无策。如果需要更多详细信息来解决问题,请告诉我。

提前致谢。

编辑:

浏览器中的 Fiddler 结果:

[Fiddler] The connection to 'ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com' failed. 
Error: TimedOut (0x274c). 
System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 54.169.173.68:80

Fiddler 结果在 Fiddler window:

Request Count:   1
Bytes Sent:      413        (headers:413; body:0)
Bytes Received:  719        (headers:207; body:512)

ACTUAL PERFORMANCE
--------------
ClientConnected:    09:38:03.718
ClientBeginRequest: 09:38:03.735
GotRequestHeaders:  09:38:03.735
ClientDoneRequest:  09:38:03.735
Determine Gateway:  0ms
DNS Lookup:         0ms
TCP/IP Connect: 21007ms
HTTPS Handshake:    0ms
ServerConnected:    09:38:24.745
FiddlerBeginRequest:    00:00:00.000
ServerGotRequest:   00:00:00.000
ServerBeginResponse:    00:00:00.000
GotResponseHeaders: 00:00:00.000
ServerDoneResponse: 00:00:00.000
ClientBeginResponse:    09:38:24.745
ClientDoneResponse: 09:38:24.745

Overall Elapsed:    0:00:21.009

RESPONSE BYTES (by Content-Type)
--------------
text/html: 512
~headers~: 207


ESTIMATED WORLDWIDE PERFORMANCE
--------------
The following are VERY rough estimates of download times when hitting  servers based in Seattle.

US West Coast (Modem - 6KB/sec)
    RTT:        0.10s
    Elapsed:    0.10s

Japan / Northern Europe (Modem)
    RTT:        0.15s
    Elapsed:    0.15s

China (Modem)
    RTT:        0.45s
    Elapsed:    0.45s

US West Coast (DSL - 30KB/sec)
    RTT:        0.10s
    Elapsed:    0.10s

Japan / Northern Europe (DSL)
    RTT:        0.15s
    Elapsed:    0.15s

China (DSL)
    RTT:        0.45s
    Elapsed:    0.45s


________________
Learn more about HTTP performance at http://fiddler2.com/r/?HTTPPERF

ping 仅告诉您该实例正在接受和回复 icmp 数据包。它有助于确定路由是否存在问题,但不能帮助您识别所有问题。

您的问题归结为两种可能的选择之一:

  1. 防火墙正在阻止与端口 80 的连接。这可能包括安全组和 windows 内部防火墙。
  2. 您的网络服务器未绑定到网络接口。 Web 服务器可以配置为绑定到接口提供的单个 IP,或者监听所有这些 IP。您还可以将站点绑定到环回,使其只能由其自身访问。

找到问题了。它与端口号或防火墙无关。问题出在 node.js 程序上。

错误是:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(80, '127.0.0.1');
console.log('Server running at http://127.0.0.1:80/');

我改成了:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen( 80 );
console.log('Server running at 80');

我刚刚删除了本地主机 IP 地址。它工作正常。

但是,感谢您的快速响应和支持。