Phoenix Configuration

I’m trying to wrap my head around elixir/phoenix configuration files. I stumbled upon this option in the config file url: [host: "", port: 80], I read the doc but still unable to wrap my head around. What is the essence of the above line and why a default port of 80, when will the above configuration be used in the application, how will this affect the http configuration.

This looks like it were the configuration for your link generator.

It will be used to generate links using your helpers.

It will not affect how the actual server listens to a port or accepts connections.

Does it imply that phx.routes depends on the above. How will the port be used if the above assertion is true.


This setting is used when you use the URL and Path helpers to create a link.

Sorry but I’m completely lost, per the docs in the prod.exs; Phoenix uses this when generating URLs. What are these uniform resource locators, are they different from links generated using e.g. page_path helper function that can be used in creating links.

As I said, that config is used when using exactly those helpers that you name here.

Thanks @NobbZ, it does make sense, my only worry is that if my http server is listening on port 4000, then any url/path should have this port, having a default port 80 seems to suggest otherwise.

The assumption is to start your application unpriviliged and let it listen on a port higher than 1024 to not require root access or capabilities.

Then you usually either run a reverse proxy that maps from 80 and 443 to the phoenix port, or you do it even on the networks stack and use iptables to directly wire incomming ports.

Awesome, thanks a lot.