Running Phoenix on Unix socket

How to do that?

I’m not sure how it would be done through Phoenix, but I believe you can pass {:local, "/path/to/unix/socket"} to :cowboy.start_clear() as a transport option. I haven’t tested this myself, but the docs would lead me to believe that.

Specifically this from the ranch_tcp docs,

On UNIX systems, it is also possible to use a UNIX Domain socket file by specifying {local, SocketFile} .


Yes, you do it like that, also set port to 0.

This thread may be helpful:

Indeed, it is possible like this:
http: [ip: {:local, '/srv/phx/project/development.socket'}, port: 0],

Thanks @entone, @hubertlepicki :slight_smile:

1 Like