簡體   English   中英

AWS EC2公共IP根本無法正常工作

[英]aws ec2 public ip not at all working

我對AWS非常陌生。 成功啟動了EC2 Windows 2012 R2實例,我能夠通過遠程桌面服務登錄。 安裝了一個nodejs應用程序,它已在localhost:80上成功運行。 但是,問題出在公共IP上。 我嘗試了很多解決方案,例如添加入站安全規則等...我什至終止了實例並重新啟動了新實例,但是沒有用。

服務器詳細信息:AWS EC2:Windows 2012 R2

每當我嘗試通過公共DNS訪問時,都會顯示“網頁不可用”。 我的公共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結果顯示什么? 公共IP是否正常工作?

請讓我知道解決方案。 我已經嘗試了好幾個小時,卻束手無策。 讓我知道是否需要更多細節來解決問題。

提前致謝。

編輯:

瀏覽器中的提琴手結果:

[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結果:

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

找到了問題。 它與端口號或防火牆無關。 問題出在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');

我剛剛刪除了localhost ip地址。 它的工作正常。

但是,感謝您的快速響應和支持。

ping僅告訴您實例正在接受和回復icmp數據包。 它有助於確定路線是否存在問題,但並不能幫助您識別所有問題。

您的問題歸結為兩個可能的選擇之一:

  1. 防火牆阻止了與端口80的連接。這可能包括安全組和Windows內部防火牆。
  2. 您的Web服務器未綁定到網絡接口。 可以將Web服務器配置為綁定到接口提供的單個IP,或偵聽所有IP。 您還可以將站點綁定到回送,使其只能自己訪問。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM