diff options
Diffstat (limited to 'templates/nginx/nginx.conf.j2')
-rw-r--r-- | templates/nginx/nginx.conf.j2 | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/templates/nginx/nginx.conf.j2 b/templates/nginx/nginx.conf.j2 index a98507f..bb0930e 100644 --- a/templates/nginx/nginx.conf.j2 +++ b/templates/nginx/nginx.conf.j2 @@ -12,7 +12,9 @@ http { sendfile on; tcp_nopush on; tcp_nodelay on; - keepalive_timeout 65; + sendfile_max_chunk 512k; + keepalive_timeout 300s; + keepalive_requests 1000; types_hash_max_size 2048; server_tokens off; @@ -40,6 +42,11 @@ http { text/javascript image/svg+xml; + upstream icecast_backend { + server 127.0.0.1:8000; + keepalive 32; + } + server { listen 80; server_name {{ domain }}; @@ -77,7 +84,7 @@ http { } location /stream { - proxy_pass http://127.0.0.1:8000/stream; + proxy_pass http://icecast_backend/stream; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -87,16 +94,22 @@ http { proxy_buffering off; proxy_request_buffering off; - proxy_read_timeout 3600s; + gzip off; + proxy_read_timeout 3600s; + proxy_connect_timeout 300s; + proxy_send_timeout 3600s; chunked_transfer_encoding on; - add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Origin "{{ radio_url }}" always; add_header Access-Control-Allow-Methods "GET, OPTIONS" always; add_header Access-Control-Allow-Headers "Range" always; add_header Access-Control-Expose-Headers "Content-Length,Content-Range" always; + + access_log off; + error_log /var/log/nginx/icecast-error.log warn; } - location /nowplaying { + location /info { proxy_pass http://127.0.0.1:8000/status-json.xsl; proxy_set_header Host $host; @@ -108,7 +121,7 @@ http { proxy_buffering off; proxy_request_buffering off; - add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Origin "{{ radio_url }}" always; add_header Access-Control-Allow-Methods "GET, OPTIONS" always; add_header Access-Control-Allow-Headers "Content-Type" always; } |