mirror of
https://github.com/YunoHost-Apps/reverseproxy_ynh.git
synced 2024-09-03 20:16:23 +02:00
41 lines
1 KiB
Bash
41 lines
1 KiB
Bash
#!/bin/bash
|
|
|
|
source /usr/share/yunohost/helpers
|
|
source _common.sh
|
|
#=================================================
|
|
# REVERSEPROXY_YNH
|
|
#=================================================
|
|
|
|
# Nginx configuration
|
|
ynh_script_progression "Configuring NGINX web server..."
|
|
|
|
path="$new_path"
|
|
domain="$old_domain"
|
|
|
|
# Validate reverse proxy destination
|
|
rp_validate_proxy_path
|
|
|
|
# Validate assets_path
|
|
rp_validate_assets_path
|
|
|
|
# Special case for "/" path
|
|
rp_handle_webroot
|
|
|
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
|
|
|
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
|
ynh_config_add_nginx
|
|
|
|
# Move file to new domain if domain has changed
|
|
if [[ "$old_domain" != "$new_domain" ]]; then
|
|
new_nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
|
|
ynh_delete_file_checksum "$nginx_conf_path"
|
|
mv $nginx_conf_path $new_nginx_conf_path
|
|
ynh_store_file_checksum "$new_nginx_conf_path"
|
|
fi
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Changing URL of $app completed"
|