# Parameters: # radio name # file path # ws port (local) # wss port (open) # upload service port # ssl certs location # TODO # /speedtest-down returns random data # can use : openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero > randomfile.bin # /speedtest-up just eat everything it can map $http_upgrade $connection_upgrade { default upgrade; '' close; } server{ listen $WEBSOCKET_PORT ssl; listen [::]:$WEBSOCKET_PORT ssl; ssl_certificate $JC_CERT/fullchain.pem; ssl_certificate_key $JC_CERT/privkey.pem; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_pass http://$NET.105:9000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 120s; } } server { listen 443 ssl; listen [::]:443 ssl; server_name $RADIO_HOST www.$RADIO_HOST; ssl_certificate $JC_CERT/fullchain.pem; ssl_certificate_key $JC_CERT/privkey.pem; root $DATA_DIR/soundbase/website; index index.html; location = /direct.ogg { proxy_pass http://$NET.109:8000/$RADIO_NAME_SIMPLE.ogg; } location = /direct.mp3 { proxy_pass http://$NET.109:8000/$RADIO_NAME_SIMPLE.mp3; } location = /api { rewrite ^ /api/; } location ~ /api(/.*) { auth_basic "Entrez votre identifiant et mot de passe"; auth_basic_user_file $DATA_DIR/soundbase/users.htpasswd; include uwsgi_params; uwsgi_param PATH_INFO "$1"; uwsgi_param SCRIPT_NAME /api; uwsgi_pass unix:/tmp/uwsgi/$RADIO_HOST/uwsgi-api.sock; client_max_body_size 0; proxy_connect_timeout 6000; proxy_send_timeout 60000; proxy_read_timeout 6000; send_timeout 6000; # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; } location /pige{ alias $DATA_DIR/soundbase/pige; try_files $uri $uri/ =404; } location /pigeMp3{ alias $DATA_DIR/soundbase/pigeMp3; try_files $uri $uri/ =404; } location /png { alias $DATA_DIR/soundbase/png; try_files $uri $uri/ =404; } location /jpgL { alias $DATA_DIR/soundbase/jpgL; try_files $uri $uri/ =404; } location /jpgH { alias $DATA_DIR/soundbase/jpgH; try_files $uri $uri/ =404; } location /webpL { alias $DATA_DIR/soundbase/webpL; try_files $uri $uri/ =404; } location /webpH { alias $DATA_DIR/soundbase/webpH; try_files $uri $uri/ =404; } location /ogg { alias $DATA_DIR/soundbase/ogg; try_files $uri $uri/ =404; } location /txt { # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; alias $DATA_DIR/soundbase/txt; try_files $uri $uri/ =404; } location /wavM { # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; alias $DATA_DIR/soundbase/wavM; try_files $uri $uri/ =404; } location /wav { # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; alias $DATA_DIR/soundbase/wav; try_files $uri $uri/ =404; } location /fiches { alias $DATA_DIR/soundbase/fiches; try_files $uri $uri/ =404; } location /prg { # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; alias $DATA_DIR/soundbase/prg; try_files $uri $uri/ =404; } location /listes { # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; alias $DATA_DIR/soundbase/listes; try_files $uri $uri/ =404; } location /statique { alias $DATA_DIR/soundbase/statique; try_files $uri $uri/ =404; # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; expires off; etag off; } # Admin interface location /manager { auth_basic "Entrez votre identifiant et mot de passe"; auth_basic_user_file $DATA_DIR/soundbase/users.htpasswd; try_files $uri $uri/ =404; } location = /favicon.ico { return 301 /favicon.webp; } # for js, css, html — dynamic site, players location / { try_files $uri $uri/ =404; add_header Cache-Control 'public must-revalidate'; } }