Where do I set my ports for my Phoenix applications?

I have an umbrella application with 3 Phoenix apps. Where can I set up my ports for each localhost?

1 Like

Good answer here: Start Phoenix app with cowboy server on different port - Stack Overflow from Chris:

Edit your config/dev.exs and change the Endpoint http port like the following:

config :my_app, MyApp.Endpoint,
  http: [port: System.get_env("PORT") || 4000],

This allows the port to be set, or left as the default 4000:

PORT=4002 mix phoenix.server # to run on port 4002
mix phoenix.server # to run on port 4000

This answer was described by @chris-mccord on github.

4 Likes