<% for(var i=0; i<list.length; i++) { var ap=list[i]; %>
#### <%= ap.name %> start ####
upstream <%= ap.name %> {
  <% for(var j=0; j<ap.host.length; j++) { -%>
  server <%= ap.host[j] %>;
  <% } -%>
}
upstream <%= ap.name %>_cache {
  server lb1:6081;
}
server {
  listen 80;
  server_name <%= ap.name %>.app.alphabets.cn;
  include proxy_setting;
  location ~ ^/static/ {
    proxy_pass http://<%= ap.name %>_cache;
    include proxy_header;
  }
  location / {
    proxy_pass http://<%= ap.name %>;
    include proxy_header;
  }
}
#### <%= ap.name %> end ####
<% } %>