anchor.diff:      passenger_show_version_in_header off;
       passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
       passenger_ruby /usr/bin/ruby;
  -    passenger_app_env <%= ENV.fetch('RAILS_ENV', 'production') %>;
  +    passenger_app_env <%= RAILS_ENV %>;
       passenger_max_pool_size <%= ENV.fetch('PASSENGER_MAX_POOL_SIZE', '6') %>;
       passenger_min_instances <%= ENV.fetch('PASSENGER_MIN_INSTANCES', '1') %>;
   
  
positive.code: worker_processes <%= ENV.fetch('NGINX_WORKER_COUNT', (ENV.fetch('RAILS_ENV', 'production') == 'production' ? 15 : 1)) %>;
  pid /run/nginx.pid;
  daemon off;
  user docker;
  
negative.code:     sendfile        on;
      keepalive_timeout  65;
  
      server {
          listen       81;
          server_name  redirect;
          access_log   off;
          if ($host = $remote_addr) {
              return   301 https://<%= APP_DOMAIN %>$request_uri;
          }
          return       301 https://$host$request_uri;
      }
  
      server {
          listen       80;
          server_name  <%= APP_DOMAIN %>;
          root <%= ENV.fetch('APP_ROOT_PATH', '/usr/src/app/public') %>;
  
          <% if CG_ENVIRONMENT != 'local' %>
              add_header Strict-Transport-Security "max-age=31536000" always;
  
              set_real_ip_from 10.0.0.0/8;
              real_ip_header X-Forwarded-For;
              real_ip_recursive on;
          <% end %>
  
          location / {
              <% if CG_ENVIRONMENT != 'local' %>
                  # TODO: These if statements need to be removed, but we need to allow time for everyone to transition to using port 81 for HTTP and 80 for HTTPS
                  if ($host = $remote_addr) {
                      return   301 https://<%= APP_DOMAIN %>$request_uri;
                  }
                  if ($http_x_forwarded_proto != 'https') {
                      return   301 https://$host$request_uri;
                  }
              <% end %>
  
              passenger_enabled on;
  
              # Occasionally you may need to add some additonial option to your location block, you can add files here to do so.
              include      /usr/src/nginx/location.d/*.conf;
          }
  
          <% if CG_ENVIRONMENT != 'local' %>
              # Match the health check path separately to prevent interference with the health check
              location <%= ENV.fetch('CG_INSTANCE_POOL_HEALTH_CHECK_PATH') %> {
                  passenger_enabled on;
              }
          <% end %>
  
          location ~ /\.git {
              deny all;
          }
      }
  }
  