upstream <%= @server_name %> {
 server unix:<%= scope.lookupvar "boxen::config::socketdir" %>/<%= @name %>;
}

server {
  access_log <%= scope.lookupvar "nginx::config::logdir" %>/<%= @name %>.access.log main;
  listen 80;
  root <%= @repo_dir %>/public;
  server_name <%= @server_name %> *.<%= @server_name %>;

  client_max_body_size 50M;
  error_page 500 502 503 504 /50x.html;

  location = /50x.html {
    root html;
  }

  try_files $uri/index.html $uri @<%= @server_name %>;
  location @<%= @server_name %> {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://<%= @server_name %>;
  }
}

upstream <%= @server_name %> {
 server unix:<%= scope.lookupvar "boxen::config::socketdir" %>/<%= @name %>;
}

server {
  access_log <%= scope.lookupvar "nginx::config::logdir" %>/<%= @name %>.access.log main;
  listen 80;
  root <%= @repo_dir %>/public;
  server_name
    <%= @server_name.gsub(/_/, '-') %>
    *.<%= @server_name.gsub(/_/, '-') %>
    ~^<%= @server_name.gsub(/_/, '-').gsub(/\.dev$/, '') %>\..*\.xip\.io$
    ~^.*\.<%= @server_name.gsub(/_/, '-').gsub(/\.dev$/, '') %>\..*\.xip\.io$;

  client_max_body_size 50M;
  error_page 500 502 503 504 /50x.html;

  location = /50x.html {
    root html;
  }

  try_files $uri/index.html $uri @<%= @server_name %>;
  location @<%= @server_name %> {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://<%= @server_name %>;
  }
}

Add xip.io support to Nginx virtual hosts
Add xip.io support to Nginx virtual hosts
