如何改变一个EC2实例的默认端口 [英] How to change the default port of an EC2 instance

查看:414
本文介绍了如何改变一个EC2实例的默认端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在端口3000上运行(我想或任何端口为此事)Rails应用程序中,我可以通过浏览到公网IP,像这样访问: 1.2.3.4:3000 但我想只是省略端口数达到相同的页面,因为我的域名注册商只允许公网IP,没有端口号。是否有一个设置的地方,将所有传入流量从网站到指定的端口?

I've got a Rails application running on port 3000 (or any port I want for that matter) and I can access it by browsing to the public ip like so: 1.2.3.4:3000 but I would like to reach the same page by simply omitting the port number, since my domain registrar only allows the public ip, and no port number. Is there a setting somewhere to direct all incoming traffic from the site to a specific port?

推荐答案

有一些方法可以做到这一点:

There are a number of ways to do this:

  • 告诉Rails使用端口80本身(见这里
  • 使用iptables来所有80端口的流量转发到3000(见这里
  • 在您的面前用ELB情况下,端口映射,从80到3000(请参阅<一href="http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-listener-config.html"相对=nofollow>这里)
  • tell rails to use port 80 natively (see here)
  • use iptables to forward all port 80 traffic to 3000 (see here)
  • front your instances with ELB, and port map from 80 to 3000 (see here)

这篇关于如何改变一个EC2实例的默认端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆