Search code examples
ruby-on-railshostforeman

etc/hosts with port number (fix for foreman)


I am using Foreman specifing port 3000. How can I access my application by writting myapp.local in the browser instead of typing 0.0.0.0:3000?

I have added:

0.0.0.0  myapp.local

But when doing myapp.local it defaults to the default localhost for Apache, not the Rails app.


Solution

  • Short answer: You can't.

    The host table is meant to map hostnames to IP addresses (Wiki). Ports come in at a different point.

    However, you can specify the port Foreman should run on:

    -p, --port
    
        Specify which port to use as the base for this application. Should be a multiple of 1000.