user  nginx;
worker_processes  1;

error_log  stderr warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format json_combined escape=json
        '{'
            '"time_local":"$time_local",'
            '"remote_addr":"$remote_addr",'
            '"remote_user":"$remote_user",'
            '"request":"$request",'
            '"status": "$status",'
            '"body_bytes_sent":"$body_bytes_sent",'
            '"request_time":"$request_time",'
            '"http_referrer":"$http_referer",'
            '"http_user_agent":"$http_user_agent"'
        '}';

    access_log /dev/stdout json_combined;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;

    server {

        server_name _;

        gzip on;
        gzip_types application/javascript image/* text/css;
        gunzip on;
        add_header X-passbook-Version 0.6.9-beta;
        add_header Vary X-passbook-Version;
        root /data/;

        location /_/healthz {
            return 204;
        }
        location ~* \.(jpg|jpeg|png|gif|ico)$ {
            expires 30d;
        }
        location ~* \.(css|js)$ {
            expires 7d;
        }

    }

    server {

        listen 8080;

        location = /stub_status {
            stub_status;
        }
    }
}