upstream unicorn {
    # fail_timeout=0 means we always retry an upstream even if it failed
    # to return a good HTTP response (in case the Unicorn master nukes a
    # single worker for timing out).

    # for UNIX domain socket setups:
    # server unix:/tmp/.sock fail_timeout=0;

    # for TCP setups, point these to your backend servers
    {% for i in 0, 4 %}
    server 127.0.0.1:{{ unicorn_listen_port + i }} fail_timeout=0;
    {% endfor %}
  }