如何改变一个EC2实例的默认端口端口、实例

2023-09-11 09:35:16 作者:找回遗失的自己

我有在端口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(请参阅这里) 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)
 
精彩推荐
图片推荐