Commit f3b2e3dd authored by Aleks's avatar Aleks
Browse files

Install/remove nginx conf using nginx helper

parent 48cbb0ad
rewrite ^PATHTOCHANGE$ PATHTOCHANGE/ permanent;
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location PATHTOCHANGE/ {
return 302 PATHTOCHANGE/fr;
location __PATH__/ {
return 302 __PATH__/fr;
}
location PATHTOCHANGE/nl {
alias ALIASTOCHANGE;
location __PATH__/nl {
alias __FINALPATH__;
index index_nl.html;
}
location PATHTOCHANGE/fr {
alias ALIASTOCHANGE;
location __PATH__/fr {
alias __FINALPATH__;
index index_fr.html;
}
......@@ -93,18 +93,7 @@ ynh_script_progression "Installing static site…"
cp -a ../sources/. $final_path
chown -R $app_user: $final_path
cp ../conf/nginx.conf "$nginx_path"
if [[ $path_url == "/" ]]; then
sed -i "/^rewrite/d" "$nginx_path"
path_url=""
fi
sed -i "s@PATHTOCHANGE@$path_url@g" "$nginx_path"
sed -i "s@ALIASTOCHANGE@$final_path@g" "$nginx_path"
nginx -tq
ynh_systemd_action nginx reload
ynh_add_nginx_config
#=================================================
# INSTALL RENEW CERT
......
......@@ -20,7 +20,6 @@ path_url=$(ynh_app_setting_get $app path_url)
app_user=$(ynh_app_setting_get $app app_user)
final_path=$(ynh_app_setting_get $app final_path)
opt_path=$(ynh_app_setting_get $app opt_path)
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#=================================================
# STANDARD REMOVE
......@@ -29,10 +28,8 @@ nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
ynh_script_progression "Removing static site..."
rm -rf $final_path
rm -f "$nginx_path"
nginx -tq
ynh_systemd_action nginx reload
ynh_remove_nginx_config
ynh_script_progression "Removing automatic vpn certificate renewal..."
......
......@@ -30,8 +30,6 @@ opt_path=$(ynh_app_setting_get $app opt_path)
manifest=/etc/yunohost/apps/$app/manifest.json
version=$(jq '.version // empty' -r -e $manifest || ynh_app_setting_get $app version)
nginx_path=/etc/nginx/conf.d/$domain.d/$app.conf
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
......@@ -129,18 +127,7 @@ mkdir -p $final_path
cp -r ../sources/. $final_path
chown -R $app_user: $final_path
cp ../conf/nginx.conf "$nginx_path"
if [[ $path_url == "/" ]]; then
sed -i "/^rewrite/d" "$nginx_path"
path_url=""
fi
sed -i "s@PATHTOCHANGE@$path_url@g" "$nginx_path"
sed -i "s@ALIASTOCHANGE@$final_path@g" "$nginx_path"
nginx -tq
ynh_systemd_action nginx reload
ynh_add_nginx_config
#=================================================
# REINSTALL RENEW CERT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment