nc-nextcloud: disable .user.ini

This commit is contained in:
nachoparker 2019-02-23 11:07:59 -07:00
parent bf1fc1fd87
commit 9c39606aab
4 changed files with 47 additions and 10 deletions

View File

@ -18,12 +18,12 @@ configure()
AUTOMEM=$(( TOTAL_MEM * 75 / 100 ))
# MAX FILESIZE
local CONF=/var/www/nextcloud/.user.ini
local CONF=/etc/php/${PHPVER}/fpm/conf.d/90-ncp.ini
local CURRENT_FILE_SIZE="$( grep "^upload_max_filesize" "$CONF" | sed 's|.*=||' )"
[[ "$MAXFILESIZE" == "0" ]] && MAXFILESIZE=10G
# MAX PHP MEMORY
local CONF=/var/www/nextcloud/.user.ini
local CONF=/etc/php/${PHPVER}/fpm/conf.d/90-ncp.ini
local CURRENT_PHP_MEM="$( grep "^memory_limit" "$CONF" | sed 's|.*=||' )"
[[ "$MEMORYLIMIT" == "0" ]] && MEMORYLIMIT=$AUTOMEM && echo "Using ${AUTOMEM}B for PHP"
sed -i "s/^post_max_size=.*/post_max_size=$MAXFILESIZE/" "$CONF"

View File

@ -213,13 +213,23 @@ EOF
echo "Setting up system..."
## SET LIMITS
sed -i "s/post_max_size=.*/post_max_size=$MAXFILESIZE/" /var/www/nextcloud/.user.ini
sed -i "s/upload_max_filesize=.*/upload_max_filesize=$MAXFILESIZE/" /var/www/nextcloud/.user.ini
sed -i "s/memory_limit=.*/memory_limit=$MEMORYLIMIT/" /var/www/nextcloud/.user.ini
cat > /etc/php/${PHPVER}/fpm/conf.d/90-ncp.ini <<EOF
; disable .user.ini files for performance and workaround NC update bugs
user_ini.filename =
# slow transfers will be killed after this time
cat >> /var/www/nextcloud/.user.ini <<< "max_execution_time=$MAXTRANSFERTIME"
cat >> /var/www/nextcloud/.user.ini <<< "max_input_time=$MAXTRANSFERTIME"
; from Nextcloud .user.ini
upload_max_filesize=$MAXFILESIZE
post_max_size=$MAXFILESIZE
memory_limit=$MEMORYLIMIT
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
output_buffering=0
; slow transfers will be killed after this time
max_execution_time=$MAXTRANSFERTIME
max_input_time=$MAXTRANSFERTIME
EOF
## SET CRON
echo "*/15 * * * * php -f /var/www/nextcloud/cron.php" > /tmp/crontab_http

View File

@ -1,5 +1,7 @@
[v1.8.2](https://github.com/nextcloud/nextcloudpi/commit/3315e2e) (2019-02-23) nc-limits: autocalculate database memory
[v1.8.3](https://github.com/nextcloud/nextcloudpi/commit/978fb73) (2019-02-23) nc-nextcloud: disable .user.ini
[v1.8.2](https://github.com/nextcloud/nextcloudpi/commit/1dfa11a) (2019-02-23) nc-limits: autocalculate database memory
[v1.8.1 ](https://github.com/nextcloud/nextcloudpi/commit/2a0dc38) (2019-02-22) lamp: adjust mariadb parameters

View File

@ -163,7 +163,7 @@ cp -r ncp-app /var/www/
# fix LE update bug
[[ -d /etc/letsencrypt/archive ]] || {
sleep 3
cp -ravT /etc/letsencrypt-old/archive /etc/letsencrypt/archive || true
cp -ravT /etc/letsencrypt-old/archive /etc/letsencrypt/archive &>/dev/null || true
bash -c "sleep 2 && service apache2 reload" &>/dev/null &
}
@ -207,6 +207,31 @@ EOF
ncc maintenance:mode --off
}
# disable .user.ini
PHPVER=7.2
[[ -f /etc/php/${PHPVER}/fpm/conf.d/90-ncp.ini ]] || {
MAXFILESIZE="$(grep upload_max_filesize /var/www/nextcloud/.user.ini | cut -d= -f2)"
MEMORYLIMIT="$(grep memory_limit /var/www/nextcloud/.user.ini | cut -d= -f2)"
cat > /etc/php/${PHPVER}/fpm/conf.d/90-ncp.ini <<EOF
; disable .user.ini files for performance and workaround NC update bugs
user_ini.filename =
; from Nextcloud .user.ini
upload_max_filesize=$MAXFILESIZE
post_max_size=$MAXFILESIZE
memory_limit=$MEMORYLIMIT
mbstring.func_overload=0
always_populate_raw_post_data=-1
default_charset='UTF-8'
output_buffering=0
; slow transfers will be killed after this time
max_execution_time=3600
max_input_time=3600
EOF
bash -c "sleep 3 && service php$PHPVER-fpm restart" &
}
# remove redundant opcache configuration. Leave until update bug is fixed -> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815968
# Bug #416 reappeared after we moved to php7.2 and debian buster packages. (keep last)
[[ "$( ls -l /etc/php/7.2/fpm/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/7.2/fpm/conf.d/*-opcache.ini | tail -1 )"