2023-01-08 14:33:31 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
source _common.sh
|
|
|
|
#=================================================
|
2023-01-08 14:46:10 +01:00
|
|
|
# REVERSEPROXY_YNH
|
2023-01-08 14:33:31 +01:00
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Nginx configuration
|
2024-08-31 02:57:32 +02:00
|
|
|
ynh_script_progression "Configuring NGINX web server..."
|
2023-11-25 19:23:56 +01:00
|
|
|
|
2023-11-25 19:16:11 +01:00
|
|
|
path="$new_path"
|
2023-01-08 15:49:37 +01:00
|
|
|
domain="$old_domain"
|
2023-01-10 13:09:57 +01:00
|
|
|
|
|
|
|
# Validate reverse proxy destination
|
|
|
|
rp_validate_proxy_path
|
|
|
|
|
|
|
|
# Validate assets_path
|
|
|
|
rp_validate_assets_path
|
|
|
|
|
2023-11-25 19:16:11 +01:00
|
|
|
# Special case for "/" path
|
2023-01-10 13:09:57 +01:00
|
|
|
rp_handle_webroot
|
|
|
|
|
2023-11-25 19:23:56 +01:00
|
|
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
2023-01-10 19:03:54 +01:00
|
|
|
|
2024-08-31 02:57:32 +02:00
|
|
|
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
|
|
|
ynh_config_add_nginx
|
2023-01-08 15:49:37 +01:00
|
|
|
|
|
|
|
# Move file to new domain if domain has changed
|
2023-11-25 19:23:56 +01:00
|
|
|
if [[ "$old_domain" != "$new_domain" ]]; then
|
|
|
|
new_nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
|
2024-08-31 02:57:32 +02:00
|
|
|
ynh_delete_file_checksum "$nginx_conf_path"
|
|
|
|
mv $nginx_conf_path $new_nginx_conf_path
|
|
|
|
ynh_store_file_checksum "$new_nginx_conf_path"
|
2023-01-10 19:03:54 +01:00
|
|
|
fi
|
2023-01-08 14:33:31 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-08-31 02:57:32 +02:00
|
|
|
ynh_script_progression "Changing URL of $app completed"
|