ctucx.git: webmusic-nginx

nginx xslt-based index files optimized for music, inspired by https://git.ztn.sh/zotan/webmusic

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
#
# !!! This file is managed by Ansible !!!
#

server {
	server_name webmusic.local;
	listen 81;

	access_log off;

	allow 127.0.0.1;
	deny all;

	root /var/lib/websites/music.ctu.cx;

	location / {
		autoindex on;
		autoindex_exact_size off;

		autoindex_format xml;
		xslt_string_param domain $http_domain;
		xslt_string_param path $uri;
		xslt_stylesheet /var/lib/websites/webmusic-assets/webmusic-playlist.xslt;
	}
}

server {
	listen 443 ssl;
	listen [::]:443 ssl;
	
	server_name music.ctu.cx;

	ssl_certificate     "/var/lib/acme-redirect/live/music.ctu.cx/fullchain";
	ssl_certificate_key "/var/lib/acme-redirect/live/music.ctu.cx/privkey";
	include /etc/nginx/ssl.conf;

	root /var/lib/websites/music.ctu.cx;
		
	location ~ ^(.*/)$ {
		autoindex on;
		autoindex_exact_size off;

		auth_basic 'Auth required';
		auth_basic_user_file /etc/nginx/passwd/music.ctu.cx;

		autoindex_format xml;
		xslt_string_param path $uri;
		xslt_stylesheet /var/lib/websites/webmusic-assets/webmusic.xslt; 
	}

	location ~(.*)playlist.m3u$ {
		set $url http://127.0.0.1:81$1;
		proxy_pass $url;
		proxy_set_header Domain $scheme://$host;
		proxy_hide_header 'Content-Type';
		add_header 'Content-Type' 'text/plain'; 
	}
	
	location /assets/ {
		alias /var/lib/websites/webmusic-assets/; 
	}
}