user  {{{sudoerUser}}};
worker_processes  auto;
error_log /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;
#include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections  {{nginx.worker_connections}};
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    
    log_format  main  '$time_iso8601###$status###$request';

    log_format  tracker escape=json
                  '{"time":"$time_iso8601","alias":"$arg_alias","uuid":"$arg_uuid",'
                  '"lg":"$arg_lg","consentcookie":"$arg_consentcookie","version":"$arg_version",'
                  '"srckey":"$arg_srckey","request_filename":"$request_filename",'
                  '"remoteaddr":"$remote_addr","httpxforwardedfor":"$http_x_forwarded_for",'
                  '"httpreferer":"$http_referer","httpuseragent":"$http_user_agent","request":"$request"}';
    
    log_format  mainold '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';

    sendfile        on;
    keepalive_timeout  65;
    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 4 32k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-font-ttf application/javascript font/eot font/opentype image/svg+xml image/x-icon text/plain;

   ##
   # Virtual Host Configs
   ##
   include /etc/nginx/conf.d/*.conf;
   include /home/{{sudoerUser}}/apxtowns/{{townId}}-{{nationId}}/conf/nginx/*.conf;
}