mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
Fix timed out sur gros fichiers #15
This commit is contained in:
parent
4f78e7a455
commit
b6d9f89e5c
7 changed files with 127 additions and 22 deletions
|
@ -13,7 +13,6 @@ 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 = 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;
|
||||
|
|
71
conf/php-fpm.conf
Normal file
71
conf/php-fpm.conf
Normal file
|
@ -0,0 +1,71 @@
|
|||
[YNH_EXAMPLE_APP]
|
||||
; The address on which to accept FastCGI requests.
|
||||
listen = /var/run/php5-fpm-YNH_EXAMPLE_APP.sock
|
||||
|
||||
; Set permissions for unix socket, if one is used.
|
||||
listen.owner = www-data
|
||||
listen.group = www-data
|
||||
listen.mode = 0600
|
||||
|
||||
; Unix user/group of processes.
|
||||
user = www-data
|
||||
group = www-data
|
||||
|
||||
; Choose how the process manager will control the number of child processes.
|
||||
pm = dynamic
|
||||
|
||||
; The number of child processes to be created when pm is set to 'static' and the
|
||||
; maximum number of child processes to be created when pm is set to 'dynamic'.
|
||||
pm.max_children = 6
|
||||
|
||||
; The number of child processes created on startup.
|
||||
pm.start_servers = 3
|
||||
|
||||
; The desired minimum number of idle server processes.
|
||||
pm.min_spare_servers = 3
|
||||
|
||||
; The desired maximum number of idle server processes.
|
||||
pm.max_spare_servers = 5
|
||||
|
||||
; The number of requests each child process should execute before respawning.
|
||||
pm.max_requests = 500
|
||||
|
||||
; The URI to view the FPM status page. If this value is not set, no URI will be
|
||||
; recognized as a status page.
|
||||
pm.status_path = /fpm-status
|
||||
|
||||
; The ping URI to call the monitoring page of FPM. If this value is not set, no
|
||||
; URI will be recognized as a ping page.
|
||||
ping.path = /ping
|
||||
|
||||
; The timeout for serving a single request after which the worker process will
|
||||
; be killed.
|
||||
request_terminate_timeout = 1d
|
||||
|
||||
; The timeout for serving a single request after which a PHP backtrace will be
|
||||
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
||||
request_slowlog_timeout = 5s
|
||||
|
||||
; The log file for slow requests.
|
||||
slowlog = /var/log/nginx/YNH_EXAMPLE_APP.slow.log
|
||||
|
||||
; Set open file descriptor rlimit.
|
||||
rlimit_files = 4096
|
||||
|
||||
; Set max core size rlimit.
|
||||
rlimit_core = 0
|
||||
|
||||
; Chdir to this directory at the start.
|
||||
chdir = YNH_EXAMPLE_ALIAS
|
||||
|
||||
; Redirect worker stdout and stderr into main error log.
|
||||
catch_workers_output = yes
|
||||
|
||||
; Do not clear environment in FPM workers.
|
||||
clear_env = no
|
||||
|
||||
; Additional php.ini defines, specific to this pool of workers.
|
||||
php_value[upload_max_filesize] = YNH_FILE_SIZE
|
||||
php_value[post_max_size] = YNH_POST_SIZE
|
||||
php_value[default_charset] = UTF-8
|
||||
php_value[always_populate_raw_post_data] = -1
|
|
@ -17,6 +17,7 @@ domain=$(sudo yunohost app setting $app domain)
|
|||
sudo cp -R $final_path/. $save_path/www/
|
||||
sudo cp -R $data_path/. $save_path/datas/
|
||||
|
||||
# backup Nginx and YunoHost parameters
|
||||
# backup php-fpm, Nginx and YunoHost parameters
|
||||
sudo cp -a /etc/yunohost/apps/$app/. $save_path/yunohost/
|
||||
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $save_path/nginx.conf
|
||||
sudo cp -a /etc/php5/fpm/pool.d/$app.conf $save_path/php-fpm.conf
|
||||
|
|
|
@ -76,16 +76,28 @@ sudo chown -R www-data: $data_path/uploads
|
|||
sudo chown -R www-data: $data_path/thumbs
|
||||
|
||||
# configure nginx settings
|
||||
## file upload size limit
|
||||
postsize=${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
|
||||
sudo sed -i "s@YNH_EXAMPLE_PATH@$path@g" ../conf/nginx.conf
|
||||
sudo sed -i "s@YNH_EXAMPLE_ALIAS@$final_path@g" ../conf/nginx.conf
|
||||
|
||||
## file upload size limit
|
||||
sudo sed -i "s@YNH_FILE_SIZE@${filesize}@g" ../conf/nginx.conf
|
||||
## copy final
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# copy and set php-fpm configuration
|
||||
## path
|
||||
sed -i "s@YNH_EXAMPLE_APP@${app}@g" ../conf/php-fpm.conf
|
||||
sed -i "s@YNH_EXAMPLE_ALIAS@${final_path}@g" ../conf/php-fpm.conf
|
||||
## file upload size limit
|
||||
sudo sed -i "s@YNH_FILE_SIZE@${filesize}@g" ../conf/php-fpm.conf
|
||||
postsize=${filesize%?}.1${filesize: -1}
|
||||
sudo sed -i "s@YNH_POST_SIZE@${postsize}@g" ../conf/php-fpm.conf
|
||||
## copy final and set permissions
|
||||
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
|
||||
sudo cp ../conf/php-fpm.conf "$phpfpm_conf"
|
||||
sudo chown root: $phpfpm_conf
|
||||
sudo chmod 644 $phpfpm_conf
|
||||
|
||||
# create the superadmin
|
||||
## set temporary public access
|
||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||
|
@ -113,5 +125,6 @@ then
|
|||
fi
|
||||
|
||||
# restart services
|
||||
sudo service nginx reload
|
||||
sudo service php5-fpm restart || true
|
||||
sudo service nginx restart || true
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -2,14 +2,18 @@
|
|||
|
||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||
set -e
|
||||
# causes the shell to exit if you try to use an uninitialised variable
|
||||
set -u
|
||||
|
||||
app=bozon
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
|
||||
sudo rm -rf /var/www/$app
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo rm -f /etc/php5/fpm/pool.d/$app.conf
|
||||
sudo rm -rf /home/yunohost.app/$app
|
||||
|
||||
# restart services
|
||||
sudo service nginx reload
|
||||
# Restart services
|
||||
sudo service php5-fpm restart || true
|
||||
sudo service nginx restart || true
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||
set -e
|
||||
# causes the shell to exit if you try to use an uninitialised variable
|
||||
set -u
|
||||
|
||||
# definie useful vars
|
||||
app=bozon
|
||||
|
@ -25,6 +27,12 @@ sudo chown -R www-data: $final_path/private
|
|||
sudo chown -R www-data: $data_path/uploads
|
||||
sudo chown -R www-data: $data_path/thumbs
|
||||
|
||||
# restore Nginx and YunoHost parameters
|
||||
# restore php-fpm, Nginx and YunoHost parameters
|
||||
sudo cp -a $save_path/yunohost/. /etc/yunohost/apps/$app/
|
||||
sudo cp -a $save_path/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo cp -a $save_path/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
|
||||
|
||||
# Restart services
|
||||
sudo service php5-fpm restart || true
|
||||
sudo service nginx restart || true
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -38,21 +38,29 @@ sudo rsync -avz --exclude="config.php" --exclude=".htaccess" $parent_path/BoZoN-
|
|||
sudo rm -R $parent_path/BoZoN-$stable
|
||||
|
||||
# configure nginx settings
|
||||
## file upload size limit
|
||||
postsize=${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
|
||||
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
|
||||
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 sed -i "s@YNH_EXAMPLE_ALIAS@$final_path@g" ../conf/nginx.conf
|
||||
## file upload size limit
|
||||
sudo sed -i "s@YNH_FILE_SIZE@${filesize}@g" ../conf/nginx.conf
|
||||
## copy final
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
# copy and set php-fpm configuration
|
||||
## path
|
||||
sed -i "s@YNH_EXAMPLE_APP@${app}@g" ../conf/php-fpm.conf
|
||||
sed -i "s@YNH_EXAMPLE_ALIAS@${final_path}@g" ../conf/php-fpm.conf
|
||||
## file upload size limit
|
||||
sudo sed -i "s@YNH_FILE_SIZE@${filesize}@g" ../conf/php-fpm.conf
|
||||
postsize=${filesize%?}.1${filesize: -1}
|
||||
sudo sed -i "s@YNH_POST_SIZE@${postsize}@g" ../conf/php-fpm.conf
|
||||
## copy final and set permissions
|
||||
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
|
||||
sudo cp ../conf/php-fpm.conf "$phpfpm_conf"
|
||||
sudo chown root: $phpfpm_conf
|
||||
sudo chmod 644 $phpfpm_conf
|
||||
|
||||
# if app is private, remove url to SSOWat conf from skipped_uris
|
||||
if [ "$is_public" = "No" ];
|
||||
then
|
||||
|
@ -65,5 +73,6 @@ then
|
|||
fi
|
||||
|
||||
# Restart services
|
||||
sudo service nginx reload
|
||||
sudo service php5-fpm restart || true
|
||||
sudo service nginx restart || true
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
Loading…
Reference in a new issue