proxy_cache_path /tmp/nginx-streaming levels=1:2 keys_zone=cache:10m max_size=1g inactive=5m;

server {
	listen 80;
	server_name {{ server_name }};
	rewrite ^ https://$host$request_uri? permanent;
}

server {
	listen 443 ssl;
	server_name {{ server_name }};

	root /var/www/streaming/;

	access_log /var/log/nginx/access_streaming.log;
	error_log /var/log/nginx/error_streaming.log;

	location /crossdomain {
	}

	location / {
		proxy_pass http://localhost:1935/;
		proxy_cache cache;
		proxy_cache_lock on;
		expires 2s;
		proxy_cache_use_stale updating;
		proxy_cache_min_uses 1;
		proxy_cache_valid 200 2s;
		add_header X-Proxy-Cache $upstream_cache_status;
		add_header X-Cache $upstream_cache_status;
		add_header Access-Control-Allow-Origin "*";
	}
}
