2023-07-04 16:23:14 +00:00
|
|
|
if [[ -z "${MAX_UPLOAD_SIZE}" ]]; then
|
|
|
|
MAX_UPLOAD_SIZE="8M" # Default fallback value
|
|
|
|
fi
|
|
|
|
|
2023-07-04 15:51:11 +00:00
|
|
|
echo "Checking if upload script exists in /var/www/html"
|
|
|
|
if [ -f "/var/www/html/upload.php" ]; then
|
2023-07-04 15:48:37 +00:00
|
|
|
echo "Upload script was found, ignoring copy."
|
2023-07-04 15:46:10 +00:00
|
|
|
else
|
2023-07-04 15:51:11 +00:00
|
|
|
cp /tmp/upload.php /var/www/html
|
2023-07-04 15:48:37 +00:00
|
|
|
echo "Upload script was not found, copying it."
|
2023-07-04 15:46:10 +00:00
|
|
|
fi
|
|
|
|
|
2023-07-05 00:49:59 +00:00
|
|
|
# Letting php know that we are running in docker
|
2023-07-05 23:36:22 +00:00
|
|
|
echo "env[DOCKER] = true" >> /etc/php/8.1/fpm/pool.d/www.conf
|
2023-07-05 23:44:07 +00:00
|
|
|
echo "clear_env = no" >> /etc/php/8.1/fpm/pool.d/www.conf
|
2023-07-05 23:23:22 +00:00
|
|
|
|
|
|
|
# echo "env[UPLOAD_SECRETS] = ${UPLOAD_SECRETS}" >> /etc/php/8.1/fpm/pool.d/www.conf
|
|
|
|
|
|
|
|
# echo "env[UPLOAD_DIR] = ${UPLOAD_DIR}" >> /etc/php/8.1/fpm/pool.d/www.conf
|
|
|
|
# echo "env[USE_RANDOM_FILE_NAMES] = ${USE_RANDOM_FILE_NAMES}" >> /etc/php/8.1/fpm/pool.d/www.conf
|
|
|
|
# echo "env[FILE_NAME_LENGTH] = ${FILE_NAME_LENGTH}" >> /etc/php/8.1/fpm/pool.d/www.conf
|
|
|
|
# echo "env[SHOULD_CONVERT_TO_WEBP] = ${SHOULD_CONVERT_TO_WEBP}" >> /etc/php/8.1/fpm/pool.d/www.conf
|
|
|
|
# echo "env[WEBP_QUALITY] = ${WEBP_QUALITY}" >> /etc/php/8.1/fpm/pool.d/www.conf
|
|
|
|
# echo "env[WEBP_THREADHOLD] = ${WEBP_THREADHOLD}" >> /etc/php/8.1/fpm/pool.d/www.conf
|
2023-07-05 00:49:59 +00:00
|
|
|
|
2023-07-04 16:32:14 +00:00
|
|
|
echo "Setting permissions for upload script"
|
|
|
|
chmod 777 /var/www/html/upload.php
|
|
|
|
|
2023-07-04 16:22:22 +00:00
|
|
|
echo "Setting max upload size to ${MAX_UPLOAD_SIZE}"
|
2023-07-04 16:42:02 +00:00
|
|
|
|
|
|
|
# Set max upload size for php
|
2023-07-04 16:22:22 +00:00
|
|
|
sed -i "s/^upload_max_filesize = .*/upload_max_filesize = ${MAX_UPLOAD_SIZE}/" /etc/php/8.1/fpm/php.ini
|
|
|
|
sed -i "s/^post_max_size = .*/post_max_size = ${MAX_UPLOAD_SIZE}/" /etc/php/8.1/fpm/php.ini
|
|
|
|
|
2023-07-04 16:42:02 +00:00
|
|
|
# Set max upload size for nginx
|
|
|
|
sed -i "s/client_max_body_size 500M;/client_max_body_size ${MAX_UPLOAD_SIZE};/" /etc/nginx/nginx.conf
|
|
|
|
|
2023-07-04 15:46:10 +00:00
|
|
|
# Start Nginx
|
2023-07-05 23:44:07 +00:00
|
|
|
echo "Starting PHP & Nginx"
|
2023-07-05 23:53:03 +00:00
|
|
|
/etc/init.d/php8.1-fpm start \
|
|
|
|
chmod 777 /run/php/php8.1-fpm.sock \
|
|
|
|
nginx -g 'daemon off;'
|