Access Phoenix Dev in local network

Hello,

I have started a phoenix app in developement mode via mix phx.server on my ubuntu machine and can access my app via localhost:4000.

Shouldn’t I be able to access it from my smartphone as well (as long as it is in the same local network) out of the box by using the ip of my ubuntu machine? http://192.168.1.109:4000 gives me an ERR_CONNECTION_REFUSED.

When I open http://192.168.1.109 I get a page titled “Apache2 Ubuntu Default Page”.

The default config starts the server on 127.0.0.1 when run in dev.
Just check you dev.exs and change http: [ip: {127, 0, 0, 1}, port: 4000] to http: [ip: {0, 0, 0, 0}, port: 4000].

3 Likes

That’s great, thank you.