How to cross compile phoenix applications for aws.
March 21, 2016
Fundica Roadshow Victoria 2016 Review
April 15, 2016
Show all

Is nginx really necessary for phoenix / elixir apps?

In the <a href="http://www.phoenixframework best slimming aids.org/docs/deployment”>advanced deployment docs they state “In many cases, we’re going to have more than one application running in our hosting environment, all of which might need to be accessible on port 80. Since only one application can listen on a single port at a time, we need to use something to proxy our application.”

Those app ports can be changed instead of having to use a reverse proxy for phoenix. I tend to have each app on its own server anyway. For example, having a database on the same server as the web app can cause issues when load gets too high for one, it could crash the other.

Reverse proxies can only handle 50k300k concurrent websocket connections. We’d be really hamstringing our app by using a reverse proxy if we wanted to take advantage of that magic 2mil concurrent connections. Phoenix can do ssl and caches static assets. Is there a reason to use nginx? Let me know if I’m wrong in the comments.

As for running multiple nodes and load balancing, shouldn’t we be embracing the erlang distributed way of doing things? I’m still new to elixir and the erlang world but it seems like this is a problem that would already be solved. Instead of running a reverse proxy for load balancing is there an erlang/elixir way that we should be promoting in the guide?

2 Comments

  1. Adèle says:

    Yeah, don’t ever make your Erlang VM listen on port 80. That’s called “bad practice” as well as “security issue”.
    It must stay unprivileged. Nginx has been reviewed and audited, and it’s the only piece of software to which you should give the permission to listen on port 80.

    • Michael Solovyov says:

      Thanks. Can you provide a link to some documentation on why it’s a security issue? Because it’s actually the vm that’s open when we set up the port in pheonix, is it?

Leave a Reply

Your email address will not be published. Required fields are marked *