1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bozon_ynh.git synced 2024-09-03 18:16:09 +02:00

Upload limit #4

This commit is contained in:
ewilly 2016-04-16 17:17:11 +02:00
parent 7602e9b19d
commit f6c1ce23c6
3 changed files with 17 additions and 2 deletions

View file

@ -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;

View file

@ -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"
}
]
}

View file

@ -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