Starting Phoenix server in a different port than 4000

Problem

You would like start a phoenix application in a port different from the default 4000, by using something similar to the rails:

rails s -p 4001

Solutin

You will need to change the config/dev.exs file to include the following:

http: [port: System.get_env("PORT") || 4000],

and then start the server with:

PORT=4002 mix phoenix.server

Taken from the answer here