Skip to content

Commit

Permalink
Switch to separate nginx conf file and update liquidsoap to master
Browse files Browse the repository at this point in the history
  • Loading branch information
mbugeia committed Dec 12, 2019
1 parent 97284ff commit eff729d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 59 deletions.
7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ services:
build:
context: liquidsoap
args:
gitbranch: reporting-tools
gitbranch: master
version: 1.5.0
buildnumber: 2448
image: privyplace/liquidsoap:reporting-tools-1.5.0-2448
buildnumber: 2462
image: privyplace/liquidsoap:master-1.5.0-2462
container_name: liquidsoap
command: /radio/live.liq
restart: unless-stopped
Expand Down Expand Up @@ -39,6 +39,7 @@ services:
- 8080:80/tcp
volumes:
- ./hls:/hls
- ./nginxhls/stream.conf:/etc/nginx/conf.d/stream.conf
prometheus:
image: prom/prometheus:v2.14.0
container_name: prometheus
Expand Down
57 changes: 1 addition & 56 deletions nginxhls/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,61 +61,6 @@ log_format json_combined escape=json
gzip_proxied any;
gzip_types application/vnd.apple.mpegurl video/mp2t;


server {
listen 80;

server_name _;

location /healthz {
access_log off;
return 200;
}

location /api {
add_header Allow "GET" always;
if ( $request_method !~ ^(GET)$ ) {
return 405;
}
rewrite /api/(.*) /$1 break;
proxy_pass http://liquidsoap:8081;
proxy_redirect off;
proxy_set_header Host $host;
}

types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}

location ~ \.(ts|m3u8)$ {
add_header Allow "GET, HEAD" always;
if ( $request_method !~ ^(GET|HEAD)$ ) {
return 405;
}

root /hls;

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET';
add_header 'Access-Control-Allow-Headers' '*';

location ~ \.(ts)$ {
add_header 'Cache-Control' 'public, max-age=31536000';
}

location ~ (lofi|midfi|hifi)\.(m3u8)$ {
add_header 'Cache-Control' 'max-age=1';
}

location ~ \.(m3u8)$ {
add_header 'Cache-Control' 'max-age=600';
}
}

location / {
return 404;
}
}
include conf.d/*.conf;

}
55 changes: 55 additions & 0 deletions nginxhls/stream.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
server {
listen 80;

server_name _;

location /healthz {
access_log off;
return 200;
}

location /api {
add_header Allow "GET" always;
if ( $request_method !~ ^(GET)$ ) {
return 405;
}
rewrite /api/(.*) /$1 break;
proxy_pass http://liquidsoap:8081;
proxy_redirect off;
proxy_set_header Host $host;
}

types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}

location ~ \.(ts|m3u8)$ {
add_header Allow "GET, HEAD" always;
if ( $request_method !~ ^(GET|HEAD)$ ) {
return 405;
}

root /hls;

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET';
add_header 'Access-Control-Allow-Headers' '*';

location ~ \.(ts)$ {
add_header 'Cache-Control' 'public, max-age=31536000';
}

location ~ (lofi|midfi|hifi)\.(m3u8)$ {
add_header 'Cache-Control' 'max-age=1';
}

location ~ \.(m3u8)$ {
add_header 'Cache-Control' 'max-age=600';
}
}

location / {
return 404;
}
}

0 comments on commit eff729d

Please sign in to comment.