1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00

Keep optional configuration lines in nginx.conf to allow changing URL from/to "/path" locations

Rename comment prefixes fore more readability
This commit is contained in:
Jimmy Monin 2017-08-27 09:51:33 +02:00
parent 1941993cdf
commit f402087ef8
3 changed files with 11 additions and 13 deletions

View file

@ -35,7 +35,7 @@ location @__NAME__ {
rewrite ^ __PATH__/app.php/$is_args$args;
}
#noroot location __PATH__ {
#noroot return 301 __PATH__/;
#noroot }
#for-subdir location __PATH__ {
#for-subdir return 301 __PATH__/;
#for-subdir }

View file

@ -126,13 +126,12 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_user" <<< "UPDATE craue_config_s
ynh_add_nginx_config
if [ "$path_url" = "/" ]
then
# Remove prefix on #noroot lines
sudo sed --in-place '/#noroot*/d' /etc/nginx/conf.d/$domain.d/$app.conf
# Replace "//" location (due to nginx template)
ynh_replace_string " // " " / " /etc/nginx/conf.d/$domain.d/$app.conf
# Prevent from replacing in "http://" expressions by excluding ":" as preceding character
sudo sed --in-place "s@\([^:]\)//@\1/@g" /etc/nginx/conf.d/$domain.d/$app.conf
else
# Remove #noroot lines
ynh_replace_string "#noroot" "" /etc/nginx/conf.d/$domain.d/$app.conf
# Move prefix comment #for-subdir at end of lines
sudo sed --in-place "s/#for-subdir\(.*\)/\1 #for-subdir/g" /etc/nginx/conf.d/$domain.d/$app.conf
fi
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"

View file

@ -116,13 +116,12 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_user" <<< "UPDATE craue_config_s
ynh_add_nginx_config
if [ "$path_url" = "/" ]
then
# Remove prefix on #noroot lines
sudo sed --in-place '/#noroot*/d' /etc/nginx/conf.d/$domain.d/$app.conf
# Replace "//" location (due to nginx template)
ynh_replace_string " // " " / " /etc/nginx/conf.d/$domain.d/$app.conf
# Prevent from replacing in "http://" expressions by excluding ":" as preceding character
sudo sed --in-place "s@\([^:]\)//@\1/@g" /etc/nginx/conf.d/$domain.d/$app.conf
else
# Remove #noroot lines
ynh_replace_string "#noroot" "" /etc/nginx/conf.d/$domain.d/$app.conf
# Move prefix comment #for-subdir at end of lines
sudo sed --in-place "s/#for-subdir\(.*\)/\1 #for-subdir/g" /etc/nginx/conf.d/$domain.d/$app.conf
fi
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"