Trying to answer your question based on the hexdocs.pm documentation from phoenix to see at the same time if it’s able to answer your question or that we need to add more or a better explanation
So the first one is port that exists in the url key of the endpoint configuration:
:url - configuration for generating URLs throughout the app.
The second port is the one in the http key of the endpoint configuration:
:http - the configuration for the HTTP server. Currently uses Cowboy and accepts all options as defined by Plug.Cowboy
where in above line Plug.Cowboy references this hexdoc stating:
:port - the port to run the server. Defaults to 4000 (http) and 4040 (https). Must be 0 when :ip is a {:local, path} tuple.
So we have url-port and http-port, the first one, url-port is for generating urls, so if you use a helper somewhere page_url() then it will use that port to generate the url. http-port is used for starting the actual server on that port.
It’s mostly used for when you’re hosting behind a load balancer, that the internal http-port is not the same as the external port for your clients. (that is: the app runs on port 4000 behind a load balancer which serves the pages at port 443 (https) or port 80 (http) to the clients in that case you don’t want that port 4000 inside the generated urls)
The question about the host is only needed if you use absolute urls instead of relative paths. (page_url vs page_path)
Hello! I want to run my app behind nginx, so I would like to run it on 127.0.0.1 ip, not to listen everywhere. So I tried hard last 2 hrs to solve this and have no success. It is second time I fight this exact problem (last time in docker environment though)
I tried to add host: {127,0,0,1}, ip: {127, 0, 0, 1}