worker_processes 1;
events {
    worker_connections 1024;
}
http {
    upstream otrecorder {
        server ${SERVER_HOST}:${SERVER_PORT};
    }
    server {
        listen ${LISTEN_PORT};
        listen [::]:${LISTEN_PORT};        
        root /usr/share/nginx/html;
        location /api/ {
            proxy_pass http://otrecorder/api/;
        }
        location /ws/ {
            proxy_pass http://otrecorder/ws/;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection upgrade;
        }
        location / {
            include /etc/nginx/mime.types;
            try_files $uri $uri/index.html;
        }
        
        gzip on;
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/javascript text/javascript;
    }
}

