But no matter what I try, when I start the server in production mode, it always picks up port the value from dev, even when I hardcode a port into the production config.
$ MIX_ENV=prod PORT=8080 mix phx.server
=> [info] Running HelloPhoenix.Web.Endpoint with Cowboy using http://0.0.0.0:4001
I am using Phoenix 1.3.0-rc. Any idea how to remedy this?
Do you have a link to a repository showing this behaviour? I’m going to assume that you have a config/config.exs file, and maybe you have import_config "dev.exs" or something similar.
Update: I have it working now, after doing a unreproducible combination of mix clean and MIX_DEBUG=1 it now launches like this:
[info] Running HelloPhoenix.Web.Endpoint with Cowboy using http://:::8080
Don’t know where the triple colon comes from, but it works.
I suspect the culprit was that I initially tried this with PORT=80 and sudo mix which apparently is not the way to go, falls back silently and makes some things stick around?
Final update: sudo mix was the culprit. This always falls back to the dev config.