diff --git a/check_process b/check_process index d79d55a..9dc103e 100644 --- a/check_process +++ b/check_process @@ -15,23 +15,11 @@ multi_instance=1 wrong_user=1 wrong_path=1 - incorrect_path=1 - corrupt_source=0 - fail_download_source=0 port_already_use=0 - final_path_already_use=0 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto - Level 4=na -# https://github.com/YunoHost-Apps/rss-bridge_ynh/issues/2 - Level 5=1 - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 + change_url=1 + ;;; Levels + # If the level 5 (Package linter) is forced to 1. Please add justifications here. + Level 5=auto ;;; Upgrade options ; commit=7a99e018f12d91876c84efd04e0a4e7f178fdd80 name=Upgrade to upstream version 2018-04-06 diff --git a/conf/nginx.conf b/conf/nginx.conf index 2e7a3c1..8e0d842 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,8 @@ -location YNH_WWW_PATH { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { # Path to source - alias YNH_WWW_ALIAS/ ; + alias __FINALPATH__/ ; # Example PHP configuration (remove if not used) index index.php; @@ -12,8 +13,8 @@ location YNH_WWW_PATH { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm-YNH_WWW_APP.sock; - + fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_index index.php; include fastcgi_params; diff --git a/scripts/change_url b/scripts/change_url index 7ba6576..7499f2b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,6 +21,9 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + #================================================= # CHECK PATHS SYNTAX #================================================= @@ -60,7 +63,13 @@ then # Make a backup of the original nginx config file if modified ynh_backup_if_checksum_is_different "$nginx_conf_path" - ynh_replace_string "location $old_path" "location $new_path" "$nginx_conf_path" + # Set global variables for nginx helper + domain="$old_domain" + path_url="$new_path" + # Store path_url setting + ynh_app_setting_set $app path_url "$path_url" + # Create a dedicated nginx config + ynh_add_nginx_config # Calculate and store the nginx config file checksum ynh_store_file_checksum "$nginx_conf_path" diff --git a/scripts/install b/scripts/install index 929fbc6..f06a1f6 100644 --- a/scripts/install +++ b/scripts/install @@ -81,12 +81,8 @@ done # NGINX CONFIGURATION #================================================= -nginx_conf=$PKGDIR/conf/nginx.conf - -ynh_replace_string "YNH_WWW_PATH" "$path_url" "$nginx_conf" -ynh_replace_string "YNH_WWW_ALIAS" "$final_path" "$nginx_conf" -ynh_replace_string "YNH_WWW_APP" "${app}" "$nginx_conf" -sudo cp "$nginx_conf" "/etc/nginx/conf.d/${domain}.d/${app}.conf" +# Create a dedicated nginx config +ynh_add_nginx_config # Copy and set php-fpm configuration phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf" diff --git a/scripts/remove b/scripts/remove index 4afcd64..4f370d4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -35,13 +35,13 @@ ynh_secure_remove "/var/www/$app" # REMOVE NGINX AND PHP-FPM CONFIGURATION #================================================= # Delete app directory and configurations -sudo ynh_secure_remove --file="/var/www/${app}" -sudo ynh_secure_remove --file="/etc/php5/fpm/pool.d/${app}.conf" +ynh_secure_remove --file="/var/www/${app}" +ynh_secure_remove --file="/etc/php5/fpm/pool.d/${app}.conf" [[ -n $domain ]] && sudo ynh_secure_remove --file="/etc/nginx/conf.d/${domain}.d/${app}.conf" # Reload services -sudo systemctl restart php5-fpm -sudo systemctl reload nginx +systemctl restart php5-fpm +systemctl reload nginx #================================================= # REMOVE DEDICATED USER diff --git a/scripts/upgrade b/scripts/upgrade index 520e310..09b04e4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -78,12 +78,8 @@ done # NGINX CONFIGURATION #================================================= -nginx_conf=$PKGDIR/conf/nginx.conf - -ynh_replace_string "YNH_WWW_PATH" "$path_url" "$nginx_conf" -ynh_replace_string "YNH_WWW_ALIAS" "$final_path" "$nginx_conf" -ynh_replace_string "YNH_WWW_APP" "${app}" "$nginx_conf" -sudo cp "$nginx_conf" "/etc/nginx/conf.d/${domain}.d/${app}.conf" +# Create a dedicated nginx config +ynh_add_nginx_config # Copy and set php-fpm configuration phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"