1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ampache_ynh.git synced 2024-09-03 18:15:55 +02:00

fix contextpath management

This commit is contained in:
aymhce 2017-09-06 21:50:48 +00:00
parent 50b100fab1
commit a99dd0c1af
2 changed files with 14 additions and 12 deletions

View file

@ -8,13 +8,13 @@ location PATHTOCHANGE {
#enable subsonic api #enable subsonic api
if ( !-d $request_filename ) { if ( !-d $request_filename ) {
rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last; rewrite ^PATH2TOCHANGE/rest/(.*)\.view$ PATH2TOCHANGE/rest/index.php?action=$1 last;
rewrite ^PATHTOCHANGE/rest/fake/(.+)$ PATHTOCHANGE/play/$1 last; rewrite ^PATH2TOCHANGE/rest/fake/(.+)$ PATH2TOCHANGE/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 ^PATH2TOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/player/(.*)/name/(.*)$ PATH2TOCHANGE/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 ^PATH2TOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/bitrate/([0-9]+)/player/(.*)/name/(.*)$ PATH2TOCHANGE/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; rewrite ^PATH2TOCHANGE/play/ssid/(.*)/type/(.*)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/transcode_to/(w+)/bitrate/([0-9]+)/player/(.*)/name/(.*)$ PATH2TOCHANGE/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; index index.php;
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
@ -28,20 +28,20 @@ location PATHTOCHANGE {
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ^~ PATHTOCHANGE/bin/ { location ^~ PATH2TOCHANGE/bin/ {
deny all; deny all;
return 403; return 403;
} }
location ^~ PATHTOCHANGE/config/ { location ^~ PATH2TOCHANGE/config/ {
deny all; deny all;
return 403; return 403;
} }
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 ^PATH2TOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATH2TOCHANGE/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; rewrite ^PATH2TOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ PATH2TOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last;
location PATHTOCHANGE/rest { location PATH2TOCHANGE/rest {
limit_except GET POST { limit_except GET POST {
deny all; deny all;
} }

View file

@ -19,13 +19,15 @@ ampache_ynh_prepareconfig () {
sudo sed -i "s/yunouser/$app/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunouser/$app/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunobase/$app/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunobase/$app/g" $final_path/config/ampache.cfg.php
sudo sed -i "s@PATHTOCHANGE@${path%/}@g" $final_path/config/ampache.cfg.php sudo sed -i "s@PATHTOCHANGE@${path}@g" $final_path/config/ampache.cfg.php
sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
} }
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
ampache_ynh_preparenginx () { ampache_ynh_preparenginx () {
sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf* path2=$(if [ "$path" == "/" ] ; then echo "" ; else echo "$path" ; fi)
sed -i "s@PATHTOCHANGE@${path}@g" ../conf/nginx.conf*
sed -i "s@PATH2TOCHANGE@${path2}@g" ../conf/nginx.conf*
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf* sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
} }