diff --git a/conf/nginx.conf b/conf/nginx.conf index 67ee1e9..eac9606 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,6 +5,17 @@ location PATHTOCHANGE { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + + #enable subsonic api + if ( !-d $request_filename ) { + rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last; + rewrite ^PATHTOCHANGE/rest/fake/(.+)$ PATHTOCHANGE/play/$1 last; + } + + rewrite ^PATHTOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/player/(.*)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&player=$7&name=$8 last; + rewrite ^PATHTOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/bitrate/([0-9]+)/player/(.*)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&bitrate=$7player=$8&name=$9 last; + rewrite ^PATHTOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/transcode_to/(w+)/bitrate/([0-9]+)/player/(.*)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&transcode_to=$7&bitrate=$8&player=$9&name=$10 last; + index index.php; try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { @@ -29,12 +40,7 @@ location PATHTOCHANGE { rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last; rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last; - - #enable subsonic api - if ( !-d $request_filename ) { - rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last; - rewrite ^PATHTOCHANGE/rest/fake/(.+)$ PATHTOCHANGE/play/$1 last; - } + location PATHTOCHANGE/rest { limit_except GET POST { deny all;