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-04 16:32:14 +00:00
|
|
|
echo "Setting permissions for upload script"
|
|
|
|
chmod 777 /var/www/html/upload.php
|
|
|
|
|
2023-07-04 16:15:53 +00:00
|
|
|
# Start php dep
|
|
|
|
echo "Starting PHP"
|
|
|
|
service php8.1-fpm start
|
|
|
|
|
2023-07-04 16:22:22 +00:00
|
|
|
echo "Setting max upload size to ${MAX_UPLOAD_SIZE}"
|
|
|
|
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
|
|
|
|
|
|
|
|
# Restart php to apply changes
|
2023-07-04 16:25:08 +00:00
|
|
|
echo "Restarting PHP to apply changes for max upload size"
|
2023-07-04 16:22:22 +00:00
|
|
|
service php8.1-fpm restart
|
|
|
|
|
2023-07-04 16:28:09 +00:00
|
|
|
# I don't know how to fix this properly, but it works.
|
|
|
|
chmod 777 /run/php/php8.1-fpm.sock
|
|
|
|
|
2023-07-04 15:46:10 +00:00
|
|
|
# Start Nginx
|
|
|
|
echo "Starting Nginx"
|
|
|
|
nginx -g "daemon off;"
|