The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
---
<%= '%' %> my $nginx_prefix = "$ENV{HOME}/var/run/nginx/$app/";
nginx :
  '-p' : <<%= '%' %>= $nginx_prefix <%= '%' %>>
  '-c' : <<%= '%' %>= $nginx_prefix <%= '%' %>>/conf/nginx.conf
  autogen :
       filename : <<%= '%' %>= $nginx_prefix <%= '%' %>>conf/nginx.conf
       content :  |
            # autogenerated file
            events {
              worker_connections  4096;
            }
            error_log <<%= '%' %>= $nginx_prefix <%= '%' %>>/logs/error.log;
            pid <<%= '%' %>= $nginx_prefix <%= '%' %>>/nginx.pid;
            http {
                client_body_temp_path <<%= '%' %>= $nginx_prefix <%= '%' %>>/tmp;
                proxy_temp_path <<%= '%' %>= $nginx_prefix <%= '%' %>>/tmp;
                fastcgi_temp_path <<%= '%' %>= $nginx_prefix <%= '%' %>>/tmp;
                uwsgi_temp_path <<%= '%' %>= $nginx_prefix <%= '%' %>>/tmp;
                scgi_temp_path <<%= '%' %>= $nginx_prefix <%= '%' %>>/tmp;
                access_log <<%= '%' %>= $nginx_prefix <%= '%' %>>/logs/access.log;
                error_log <<%= '%' %>= $nginx_prefix <%= '%' %>>/logs/error.log;
                upstream myapp {
                  server <<%= '%' %>= $backend_url <%= '%' %>>;
                }
                server {
                  # port from url goes here
                  listen <<%= '%' %>= $port <%= '%' %>>;
                  server_name localhost;
                  location "/" {
                    proxy_read_timeout 300;
                    proxy_pass http://myapp;
                    proxy_set_header Host $http_host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                  }
                }
            }