This looks like a bug but I am not sure. Can anyone tell if running iex on different port number works. It always uses port 4000.
PORT=4001 iex -S mix phoenix.server
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
[info] Running AppMessenger.Endpoint with Cowboy using http on port 4000
Interactive Elixir (1.2.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 19 May 19:53:40 - info: compiled 5 files into 2 files, copied 3 in 714ms
By default, config/dev.exs
has a hardcoded value 4000
for the port in Phoenix. If you want to use the value from PORT
environment variable in dev
, in config/dev.exs
change:
http: [port: 4000]
to
http: [port: {:system, "PORT"}]