worker_processes  1;
events {
    worker_connections  1024;
}

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

    #sendfile        off;
    keepalive_timeout  65;

    upstream django {
      server 127.0.0.1:8000;
    }

    server {
        listen 443 ssl;
        http2 on;
        server_name example.com;

        ssl_certificate selfsigned.crt;
        ssl_certificate_key selfsigned.key;

        location /static/ {
            alias %%WWWDIR%%/static/;
        }

        location / {
            proxy_pass http://django;
            include uwsgi_params;
            proxy_set_header Host $host;
            proxy_http_version 1.1;
        }

        location /ws/status/ {
            proxy_pass http://django/ws/status/;
            proxy_set_header Host $host;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }

        #location /flower/ {
        #    proxy_pass http://127.0.0.1:5555;
        #    proxy_set_header Host 127.0.0.1;
        #    proxy_http_version 1.1;
        #}

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }
    }
}
