daemon off;
user root;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections 768;
}

http {

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    client_max_body_size 100M;

    include /etc/nginx/mime.types;

    access_log /emblem/log/access.log;
    error_log /emblem/log/error.log;

    gzip on;
    gzip_types text/plain application/javascript;

    upstream api {
        server unix:/tmp/gunicorn.sock;
    }

    server {
        listen 0.0.0.0:80;
        root /emblem/web/dist;
        index index.html;

        location ~ /api/static/ {
            root /emblem/api/;
        }

        location ~ ^/(api|v)/ {
            proxy_pass http://api;
            proxy_read_timeout 60s;
            proxy_send_timeout 60s;
        }

        location / {
            try_files $uri $uri/ /index.html;
        }

        # the wechat scrutiny nonsense
        location /e89187b02d37d93612ad98b1edc5e68b.txt {
          return 200 'fcb42690c866dd64566b5e79bb06d8768c7b1608';
        }
    }

}
