From 74786d9d304510afd9c8e8b8164d8fc811a5e42a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 10 Jun 2022 20:54:23 +0200 Subject: [PATCH] Fix --- conf/nginx.conf | 44 ++++++++++++++++++++++++++------------------ scripts/install | 18 +++++++++--------- scripts/remove | 8 ++++++++ 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b625e73..82fd166 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,17 +1,40 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -root __FINALPATH__/; location __PATH__/ { + # Path to source + alias __FINALPATH__/; + index index.php; + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + #client_max_body_size 50M; + + try_files $uri $uri/ index.php; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param HTTPS on; + fastcgi_buffers 8 256k; + fastcgi_buffer_size 128k; + fastcgi_intercept_errors on; + } + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ { -return 302 /; + return 302 /; } location ~* \.(?:bat|git|ini|sh|svn[^.]*|txt|tpl|xml)$ { -return 404; + return 404; } # Main @@ -77,18 +100,3 @@ rewrite ^/headers/original/missing.png$ /assets/images/missing_header.png break; # 404 rewrite ^/404/?$ /404.php break; - -location ~ [^/]\.php(/|$) { -fastcgi_split_path_info ^(.+?\.php)(/.*)$; -include fastcgi_params; -fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; -if (!-f $document_root$fastcgi_script_name) { -return 404; -} -fastcgi_param PATH_INFO $fastcgi_path_info; -fastcgi_param HTTPS on; -fastcgi_buffers 8 256k; -fastcgi_buffer_size 128k; -fastcgi_intercept_errors on; -fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; -} diff --git a/scripts/install b/scripts/install index b1bde4c..a379170 100755 --- a/scripts/install +++ b/scripts/install @@ -77,6 +77,15 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # NGINX CONFIGURATION #================================================= @@ -85,15 +94,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/remove b/scripts/remove index dd82985..cac97ac 100755 --- a/scripts/remove +++ b/scripts/remove @@ -45,6 +45,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # GENERIC FINALIZATION #=================================================