summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorheqnx <root@heqnx.com>2025-07-05 15:20:35 +0300
committerheqnx <root@heqnx.com>2025-07-05 15:20:35 +0300
commitc66cac3652d275b9dbc09166f112bb7df71a501b (patch)
tree7f7d1efcaf1540249a81443a0f77bdb69325c0a8 /templates
parent6603f4d2c4e6e32d0a27872badfe24ad2d403caf (diff)
downloadansible-icecast2-c66cac3652d275b9dbc09166f112bb7df71a501b.tar.gz
ansible-icecast2-c66cac3652d275b9dbc09166f112bb7df71a501b.zip
fine tuned nginx for streaming
Diffstat (limited to 'templates')
-rw-r--r--templates/nginx/nginx.conf.j225
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;
}