简体   繁体   中英

Running iex mix phoenix.server on a different port does not work

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"}]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM