From f6c1ce23c6d065e5a77fc8d670d463994a14c430 Mon Sep 17 00:00:00 2001 From: ewilly Date: Sat, 16 Apr 2016 17:17:11 +0200 Subject: [PATCH 1/4] Upload limit #4 --- conf/nginx.conf | 4 ++-- manifest.json | 8 ++++++++ scripts/install | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 2517e61..34da5a8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,7 +4,7 @@ location YNH_EXAMPLE_PATH { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - client_max_body_size 10G; + client_max_body_size YNH_FILE_SIZE; index index.php; try_files $uri $uri/ index.php; @@ -13,7 +13,7 @@ location YNH_EXAMPLE_PATH { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; - fastcgi_param PHP_VALUE "upload_max_filesize = 2G \n post_max_size=2.1G"; + fastcgi_param PHP_VALUE "upload_max_filesize = YNH_FILE_SIZE \n post_max_size=YNH_POST_SIZE"; fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; diff --git a/manifest.json b/manifest.json index 961676a..902bf0e 100644 --- a/manifest.json +++ b/manifest.json @@ -63,6 +63,14 @@ }, "choices": ["de","en","es","fr","it","nl","pl","pt","po","ro","ru"], "default": "en" + }, + { + "name": "filesize", + "ask": { + "en": "Define the file upload size limit", + "fr": "Définissez la taille limite de téléchargement" + }, + "default": "2G" } ] } diff --git a/scripts/install b/scripts/install index 88350fc..133eeba 100644 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,7 @@ path=$2 admin=$3 is_public=$4 default_lang=$5 +filesize=$6 # definie useful vars app=bozon @@ -67,6 +68,11 @@ sudo chown -R www-data: $data_path/uploads sudo chown -R www-data: $data_path/thumbs # configure nginx settings +## file upload size limit +postsize=$(echo "${filesize%?} + 0.1" | bc)$(echo ${filesize: -1}) +sudo sed -i "s@YNH_FILE_SIZE@$filesize@g" ../conf/nginx.conf +sudo sed -i "s@YNH_POST_SIZE@$postsize@g" ../conf/nginx.conf +## path folder_path=${path%/} sudo sed -i "s@YNH_EXAMPLE_PATH@$path@g" ../conf/nginx.conf # if path is only / (without subfolder), add trailing slash to alias @@ -74,6 +80,7 @@ alias_path=$final_path [ "$path" == '/' ] && alias_path=$alias_path'/' sudo sed -i "s@YNH_EXAMPLE_ALIAS@$alias_path@g" ../conf/nginx.conf sudo sed -i "s@YNH_EXAMPLE_FOLDER@$folder_path@g" ../conf/nginx.conf + sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf # if app is private, remove url to SSOWat conf from skipped_uris From 3d88020caf88eb6cdeb30492c0d1e17112b7db95 Mon Sep 17 00:00:00 2001 From: ewilly Date: Sat, 16 Apr 2016 19:52:04 +0200 Subject: [PATCH 2/4] Default language #5 --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 133eeba..955e850 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,7 @@ sudo find $final_path -type f | xargs sudo chmod 644 sudo find $final_path -type d | xargs sudo chmod 755 # configure config file -sudo sed -i "s@'en'@'$default_lang'@g" $final_path/config.php +sudo sed -i "s@default_language='en';@default_language='$default_lang';@g" $final_path/config.php # create data folders sudo mkdir -p $final_path/private From 53507c30a72d58187c257453e0d3d7afd36cc713 Mon Sep 17 00:00:00 2001 From: ewilly Date: Sat, 16 Apr 2016 20:13:14 +0200 Subject: [PATCH 3/4] Upload limit #4 (fix bc installation) --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 955e850..bf85f2f 100644 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,7 @@ sudo rm $parent_path/master.zip sudo mv $parent_path/BoZoN-master $parent_path/$app # add required packages -sudo apt-get install php5-curl php5-gd +sudo apt-get install php5-curl php5-gd bc # copy files to final folder and set permissions sudo find $final_path -type f -name ".htaccess" | xargs sudo rm From 616d7c42b224a0dbe3d60c522b6f98bb5f41b161 Mon Sep 17 00:00:00 2001 From: ewilly Date: Sat, 16 Apr 2016 20:43:00 +0200 Subject: [PATCH 4/4] Upload limit #4 (don't need anymore bc) --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index bf85f2f..5d39b26 100644 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,7 @@ sudo rm $parent_path/master.zip sudo mv $parent_path/BoZoN-master $parent_path/$app # add required packages -sudo apt-get install php5-curl php5-gd bc +sudo apt-get install php5-curl php5-gd # copy files to final folder and set permissions sudo find $final_path -type f -name ".htaccess" | xargs sudo rm @@ -69,7 +69,7 @@ sudo chown -R www-data: $data_path/thumbs # configure nginx settings ## file upload size limit -postsize=$(echo "${filesize%?} + 0.1" | bc)$(echo ${filesize: -1}) +postsize=$(echo "${filesize%?}.1${filesize: -1}") sudo sed -i "s@YNH_FILE_SIZE@$filesize@g" ../conf/nginx.conf sudo sed -i "s@YNH_POST_SIZE@$postsize@g" ../conf/nginx.conf ## path