server {
    listen 8080 default_server;
    listen [::]:8080 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name localhost;

    
    # root location goes to static content in the folder configured as root
    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
    }

    # the api ist reverse proxied locally to port 8001
    location /api {
            rewrite ^/api(.*) /$1 break;
            proxy_pass http://127.0.0.1:8001;
            # the local api in this case provides https streams
            # therefore caching needs to be disabled.
            proxy_set_header Connection '';
            proxy_http_version 1.1;
            proxy_buffering off;
            proxy_cache off;
            proxy_read_timeout 300s;
            chunked_transfer_encoding off;
    }
}