summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-05 21:53:27 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-05 21:53:27 +0100
commitf769d3e24676b1cec9f950b985a55f3dff36aa2e (patch)
tree4bfa1d238aa505f945b45e2380dada6ecdd30dd2
parent299f2c26a867bdb5c05fdf107570dfa776531d7e (diff)
downloadwebmusic-nginx-f769d3e24676b1cec9f950b985a55f3dff36aa2e.tar.gz
webmusic-nginx-f769d3e24676b1cec9f950b985a55f3dff36aa2e.tar.bz2
webmusic-nginx-f769d3e24676b1cec9f950b985a55f3dff36aa2e.zip
update nginx-config: allow direct file access but require basic-auth for directory listings
-rw-r--r--nginx.conf23
1 files changed, 2 insertions, 21 deletions
diff --git a/nginx.conf b/nginx.conf
index effe0c8..c42e6d7 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -36,16 +36,11 @@ server {
root /var/lib/websites/music.ctu.cx;
- location / {
+ location ~ ^(.*/)$ {
autoindex on;
autoindex_exact_size off;
-
- set $basic_auth off;
- if ($http_user_agent != 'libmpv') {
- set $basic_auth 'Auth required';
- }
- auth_basic $basic_auth;
+ auth_basic 'Auth required';
auth_basic_user_file /etc/nginx/passwd/music.ctu.cx;
autoindex_format xml;
@@ -54,13 +49,6 @@ server {
}
location ~(.*)playlist.m3u$ {
- set $basic_auth off;
- if ($http_user_agent != 'libmpv') {
- set $basic_auth 'Auth required';
- }
- auth_basic $basic_auth;
- auth_basic_user_file /etc/nginx/passwd/music.ctu.cx;
-
set $url http://127.0.0.1:81$1;
proxy_pass $url;
proxy_set_header Domain $scheme://$host;
@@ -69,13 +57,6 @@ server {
}
location /assets/ {
- set $basic_auth off;
- if ($http_user_agent != 'libmpv') {
- set $basic_auth 'Auth required';
- }
- auth_basic $basic_auth;
- auth_basic_user_file /etc/nginx/passwd/music.ctu.cx;
-
alias /var/lib/websites/webmusic-assets/;
}
}