Search code examples
ruby-on-railsamazon-web-servicesamazon-ec2webrickipv4

How to change the default port of an EC2 instance


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?


Solution

  • There are a number of ways to do this:

    • 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)