如何导航到yo生成器的服务器提供的外部URL

时间:2015-04-17 18:00:21

标签: amazon-ec2 yeoman

我正在使用yo生成器(generator-moda),在ec2实例上运行,并希望从我的浏览器导航到提供的外部网址,但我的浏览器只是挂起连接...

是否需要在ec2安全组中进行特殊的配置调整,否则允许下面的ip或主机?

    [BS] Access URLs:
 -------------------------------------
       Local: http://localhost:3000
    External: http://172.31.60.85:3000
 -------------------------------------
          UI: http://localhost:3001
 UI External: http://172.31.60.85:3001
 -------------------------------------
  [BS] Serving files from: ./app
  [17:52:19] gulp-inject 12 files into main.scss.
  [17:52:19] gulp-inject 12 files into main.scss.
[17:52:19] Starting 'html'...
[17:52:19] Finished 'html' after 3.89 ms
[BS] 1 file changed (index.html)
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [watcher]: Pattern "/home/ubuntu/dev/clients/alugha/main/app/scripts/**/*.html" does not match any file.
INFO [PhantomJS 1.9.8 (Linux)]: Connected on socket f08K4dCRmBorILmZgofR with id 91726259

1 个答案:

答案 0 :(得分:4)

问题是172.31.0.0/16是亚马逊的私有IP范围,因此您无法在VPC(亚马逊虚拟私有云)source之外访问它们。

如果要连接到运行代码的EC2实例,则需要做两件事:

  1. 连接到您可以从EC2 console获取的公共DNS主机名/ IP。您有以下说明:Determining Your Public, Private, and Elastic IP Addresses - AWS docs
  2. 打开安全组中的端口以允许您连接到您的实例。在此答案为explained how to open a port for your security group,但不是端口80,请打开30003001
  3. 然后在浏览器中复制第一步使用正确端口获得的公共DNS主机名,您应该可以加载页面。