How can I run a phoenix app on port 80 in dev mode on my local machine?

I need to get a telegram login widget working and unfortunately it only works if I run on port 80 – see this discussion to understand why: Telegram login widget in an Angular iframe error - Stack Overflow

In any case, I’m trying to get my app to run locally on port 80, which I have done by adjusting the port to 80 in my config/dev.exs file. But I’m getting an error relating to Postgres:

[error] Postgrex.Protocol (#PID<0.570.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): non-existing domain - :nxdomain

Does anyone have any idea what is going on here?

Ok, so I got past the Postgres problem. It turns out that when I edited my /etc/hosts file I removed this line;	localhost

Once I put that line back in and then restarted my MacBook I was successfully able to run mix ecto.reset and the Postgres connection stopped giving me problems.

The next issue was making sure I used sudo to start my dev server:

sudo mix phx.server
1 Like