To run phoenix app on a custom port other than port 4000, tweak your config file for respective environment(dev/prod/test) to the following:
config :my_app, MyApp.Endpoint,
http: [port: {:system, "PORT"}],
Then from the terminal:
$ PORT=4001 mix phoenix.server
$ PORT=4002 mix phoenix.server