mirror of
https://github.com/YunoHost-Apps/dokuwiki_ynh.git
synced 2024-09-03 18:26:20 +02:00
[fix] Nginx location & path trailing slash.
This commit is contained in:
parent
ef32510a43
commit
f8e809a163
3 changed files with 32 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
location YNH_WWW_PATH {
|
||||
location YNH_WWW_LOCATION {
|
||||
|
||||
alias YNH_WWW_ALIAS ;
|
||||
|
||||
|
@ -21,7 +21,7 @@ location YNH_WWW_PATH {
|
|||
}
|
||||
|
||||
# Secure DokuWiki
|
||||
location ~ ^YNH_WWW_PATH/(data|conf|bin|inc)/ {
|
||||
location ~ ^YNH_WWW_PATH(data|conf|bin|inc)/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,20 @@ if [[ ! $? -eq 0 ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Path need a trailing slash, and location does not.
|
||||
# See conf/nginx.conf usage
|
||||
location=$path
|
||||
if [[ ! $path == */ ]]; then
|
||||
# no trailing slash, so add it
|
||||
path=$path/
|
||||
fi
|
||||
if [[ ! "$location" == "/" ]]; then
|
||||
# remove possible trailing slash
|
||||
location=${location%/}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Modify dokuwiki conf
|
||||
sed -i "s@YNH_ADMIN_USER@$admin@g" ../conf/$APP.php
|
||||
|
||||
|
@ -36,6 +50,7 @@ sudo chown -R www-data:root $final_path/{conf,data,data/attic,data/cache,data/in
|
|||
sudo chmod -R 700 $final_path/{conf,data,data/attic,data/cache,data/index,data/locks,data/media*,data/meta,data/pages,data/tmp,lib/plugins}
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sed -i "s@YNH_WWW_LOCATION@$location@g" ../conf/nginx.conf
|
||||
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/dokuwiki.conf
|
||||
|
|
|
@ -8,12 +8,22 @@ is_public=$(sudo yunohost app setting dokuwiki is_public)
|
|||
# admin default value, if not set
|
||||
if [ -z "$admin" ];
|
||||
then
|
||||
admin=$(sudo yunohost user list | grep 'username' -m1 | awk '{print $2}')
|
||||
sudo yunohost app setting dokuwiki is_public -v "$is_public"
|
||||
admin=$(sudo yunohost user list | grep 'username' -m1 | awk '{print $2}')
|
||||
sudo yunohost app setting dokuwiki is_public -v "$is_public"
|
||||
fi
|
||||
|
||||
# Remove trailing "/" for next commands
|
||||
path=${path%/}
|
||||
|
||||
# Path need a trailing slash, and location does not.
|
||||
# See conf/nginx.conf usage
|
||||
location=$path
|
||||
if [[ ! $path == */ ]]; then
|
||||
# no trailing slash, so add it
|
||||
path=$path/
|
||||
fi
|
||||
if [[ ! "$location" == "/" ]]; then
|
||||
# remove possible trailing slash
|
||||
location=${location%/}
|
||||
fi
|
||||
|
||||
# Modify dokuwiki conf
|
||||
sed -i "s@YNH_ADMIN_USER@$admin@g" ../conf/$APP.php
|
||||
|
@ -43,6 +53,7 @@ sudo chown -R www-data:root $final_path/{conf,data,data/attic,data/cache,data/in
|
|||
sudo chmod -R 700 $final_path/{conf,data,data/attic,data/cache,data/index,data/locks,data/media*,data/meta,data/pages,data/tmp,lib/plugins}
|
||||
|
||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sed -i "s@YNH_WWW_LOCATION@$location@g" ../conf/nginx.conf
|
||||
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/dokuwiki.conf
|
||||
|
|
Loading…
Add table
Reference in a new issue