diff --git a/conf/nginx.conf b/conf/nginx.conf index 1e7c3ac..05523a2 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - root __FINALPATH__/ ; + alias __FINALPATH__/ ; # Force usage of https if ($scheme = http) { @@ -14,7 +14,14 @@ location __PATH__/ { # 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?$query_string; + location __PATH__/yunohost { + try_files $uri $uri/ index.php; + } + + location __PATH__/ { + try_files $uri $uri/ @prettynoemiecms; + } + location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; @@ -31,6 +38,6 @@ location __PATH__/ { include conf.d/yunohost_panel.conf.inc; } -location __PATH__/medias/ { - alias __FINALPATH__/sites/$host/medias/; +location @prettynoemiecms { + rewrite /(.*)$ __PATH__/index.php?/$1 last; } diff --git a/scripts/install b/scripts/install index 3a6c241..d1fe1ce 100755 --- a/scripts/install +++ b/scripts/install @@ -146,6 +146,9 @@ ynh_app_setting_delete --app=$app --key=skipped_uris # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$final_path/sites/$domain/config.json" +# Fix a bug where images can't be uploaded +ynh_replace_string --match_string="isMediaPathModified = true" --replace_string="" --target_file="$final_path/app/config/config.ini" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 55a844d..23a587a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -130,6 +130,9 @@ ynh_backup_if_checksum_is_different --file="$final_path/sites/$domain/config.jso # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/sites/$domain/config.json" +# Fix a bug where images can't be uploaded +ynh_replace_string --match_string="isMediaPathModified = true" --replace_string="" --target_file="$final_path/app/config/config.ini" + #================================================= # GENERIC FINALIZATION #=================================================