mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
split nginx conf
This commit is contained in:
parent
daf6719139
commit
ac8f792ac4
9 changed files with 46 additions and 24 deletions
|
@ -165,15 +165,6 @@ location ^~ __PATH__/ {
|
|||
try_files $uri / __PATH__/index.php$request_uri;
|
||||
}
|
||||
|
||||
__STRING_USE_NOTIFY_PUSH__location ^~ __PATH__/push/ {
|
||||
__STRING_USE_NOTIFY_PUSH__ proxy_pass http://unix:__FINAL_PATH__/notify-push.sock:/;
|
||||
__STRING_USE_NOTIFY_PUSH__ proxy_http_version 1.1;
|
||||
__STRING_USE_NOTIFY_PUSH__ proxy_set_header Upgrade $http_upgrade;
|
||||
__STRING_USE_NOTIFY_PUSH__ proxy_set_header Connection "Upgrade";
|
||||
__STRING_USE_NOTIFY_PUSH__ proxy_set_header Host $host;
|
||||
__STRING_USE_NOTIFY_PUSH__ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
__STRING_USE_NOTIFY_PUSH__}
|
||||
|
||||
# show YunoHost panel access
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ ram.runtime = "512M"
|
|||
default = "yes"
|
||||
|
||||
[install.enable_notify_push]
|
||||
ask.en = "Configure the High Performance Backend?",
|
||||
ask.en = "Configure the High Performance Backend?"
|
||||
ask.fr = "Configurer le Backend Hautes Performances ?"
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
|
|
@ -40,6 +40,45 @@ is_url_handled() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Adapted from nginx helpers
|
||||
ynh_add_nginx_notify_push_config() {
|
||||
|
||||
local finalnginxconf="/etc/nginx/conf.d/$domain.d/${app}_notify_push.conf"
|
||||
|
||||
ynh_add_config --template="nginx_notify_push.conf" --destination="$finalnginxconf"
|
||||
|
||||
if [ "${path_url:-}" != "/" ]; then
|
||||
ynh_replace_string --match_string="^#sub_path_only" --replace_string="" --target_file="$finalnginxconf"
|
||||
else
|
||||
ynh_replace_string --match_string="^#root_path_only" --replace_string="" --target_file="$finalnginxconf"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$finalnginxconf"
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
}
|
||||
|
||||
ynh_remove_nginx_notify_push_config() {
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$domain.d/${app}_notify_push.conf"
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
}
|
||||
|
||||
|
||||
ynh_change_url_nginx_notify_push_config() {
|
||||
|
||||
# Make a backup of the original NGINX config file if manually modified
|
||||
# (nb: this is possibly different from the same instruction called by
|
||||
# ynh_add_config inside ynh_add_nginx_notify_push_config because the path may have
|
||||
# changed if we're changing the domain too...)
|
||||
local old_nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/${app}_notify_push.conf
|
||||
ynh_backup_if_checksum_is_different --file="$old_nginx_conf_path"
|
||||
ynh_delete_file_checksum --file="$old_nginx_conf_path"
|
||||
ynh_secure_remove --file="$old_nginx_conf_path"
|
||||
|
||||
# Regen the nginx conf
|
||||
ynh_add_nginx_notify_push_config
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -32,6 +32,7 @@ ynh_backup --src_path="$data_dir" --is_big
|
|||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/${app}_notify_push.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
|
|
|
@ -16,7 +16,7 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
|||
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_change_url_nginx_notify_push_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
|
|
|
@ -51,7 +51,7 @@ fi
|
|||
|
||||
if [ $enable_notify_push -eq 1 ]
|
||||
then
|
||||
ynh_add_nginx_config "${app}-notify-push"
|
||||
ynh_add_nginx_notify_push_config
|
||||
fi
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
|
@ -284,17 +284,6 @@ ynh_script_progression --message="Configuring Fail2Ban..." --weight=8
|
|||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE NOTIFY_PUSH APP
|
||||
#=================================================
|
||||
|
||||
if [ $use_notify_push -eq 1 ]
|
||||
then
|
||||
ynh_permission_create --permission="hpb" --label="High Performance Backend" --url="/push" --additional_urls="/index.php/apps/notify_push/" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# CHECK IF NOTIFY_PUSH WORKS
|
||||
#=================================================
|
||||
|
|
|
@ -12,6 +12,7 @@ ynh_script_progression --message="Removing system configurations related to $app
|
|||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_remove_nginx_notify_push_config
|
||||
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
|
|
@ -36,6 +36,7 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/${app}_notify_push.conf"
|
||||
|
||||
# Check if .well-known is available for this domain
|
||||
if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav"
|
||||
|
|
|
@ -363,7 +363,7 @@ ynh_add_nginx_config
|
|||
|
||||
if [ $enable_notify_push -eq 1 ]
|
||||
then
|
||||
ynh_add_nginx_config "${app}-notify-push"
|
||||
ynh_add_nginx_notify_push_config
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue