1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gotosocial_ynh.git synced 2024-09-03 19:16:06 +02:00

tweaking the main_domain logic

This commit is contained in:
OniriCorpe 2023-02-18 23:47:41 +01:00
parent 41675bbf88
commit 846f7ae4dc
4 changed files with 12 additions and 9 deletions

View file

@ -14,7 +14,7 @@ location / {
# If we're on the "account_domain, redirect to the main domain"
if ($is_account_domain = 1) {
rewrite ^ https://__PATH__$request_uri? permanent;
rewrite ^ https://__MAIN_DOMAIN__$request_uri? permanent;
}
if ($is_account_domain = 0) {
@ -30,11 +30,11 @@ location / {
# redirect the account_domain .well-known to the main domain one
location = /.well-known/webfinger {
if ($is_account_domain = 1) {
return 301 __PATH__/.well-known/webfinger;
rewrite ^.*$ https://__MAIN_DOMAIN__/.well-known/webfinger permanent;
}
}
location = /.well-known/nodeinfo {
if ($is_account_domain = 1) {
return 301 __PATH__/.well-known/nodeinfo;
rewrite ^.*$ https://__MAIN_DOMAIN__/.well-known/nodeinfo permanent;
}
}

View file

@ -210,6 +210,8 @@ chown -R "$app:www-data" "$final_path"
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
main_domain="$domain"
# Create a dedicated NGINX config for the main domain
ynh_add_nginx_config
@ -217,13 +219,12 @@ ynh_add_nginx_config
if [ "$domain" != "$account_domain" ] && [ -n "$account_domain" ]; then
# switching domain name for tricking ynh_add_nginx_config (who supports only the 'domain' variable)
domain_backup="$domain"
domain="$account_domain"
ynh_add_nginx_config
# undo the trick
domain="$domain_backup"
domain="$main_domain"
fi
#=================================================

View file

@ -82,6 +82,8 @@ ynh_secure_remove --file="$datadir"
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
main_domain="$domain"
# Remove the dedicated NGINX config of the main domain
ynh_remove_nginx_config
@ -89,13 +91,12 @@ ynh_remove_nginx_config
if [ "$domain" != "$account_domain" ] && [ -n "$account_domain" ]; then
# switching domain name for tricking ynh_add_nginx_config (who supports only the 'domain' variable)
domain_backup="$domain"
domain="$account_domain"
ynh_remove_nginx_config
# undo the trick
domain="$domain_backup"
domain="$main_domain"
fi
#=================================================

View file

@ -278,6 +278,8 @@ chown -R "$app:www-data" "$final_path"
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
main_domain="$domain"
# Create a dedicated NGINX config for the main domain
ynh_add_nginx_config
@ -285,13 +287,12 @@ ynh_add_nginx_config
if [ "$domain" != "$account_domain" ] && [ -n "$account_domain" ]; then
# switching domain name for tricking ynh_add_nginx_config (who supports only the 'domain' variable)
domain_backup="$domain"
domain="$account_domain"
ynh_add_nginx_config
# undo the trick
domain="$domain_backup"
domain="$main_domain"
fi
#=================================================