start work on making init script work
All checks were successful
/ docker (push) Successful in 27s

This commit is contained in:
Lee 2023-07-08 00:16:13 +01:00
parent 14ca6a6ba3
commit bcb0a5d61a

@ -1,4 +1,6 @@
if [[ -z "${MAX_UPLOAD_SIZE}" ]]; then
#!/bin/sh
if [ -z "$MAX_UPLOAD_SIZE" ]; then
MAX_UPLOAD_SIZE="8M" # Default fallback value
fi
@ -11,8 +13,8 @@ else
fi
# Letting php know that we are running in docker
echo "env[DOCKER] = true" >> /etc/php/8.1/fpm/pool.d/www.conf
echo "clear_env = no" >> /etc/php/8.1/fpm/pool.d/www.conf
echo "env[DOCKER] = true" >> /etc/php81/php-fpm.d/www.conf
echo "clear_env = no" >> /etc/php81/php-fpm.d/www.conf
echo "Setting permissions for upload script"
chmod 777 /var/www/html/upload.php
@ -20,16 +22,15 @@ chmod 777 /var/www/html/upload.php
echo "Setting max upload size to ${MAX_UPLOAD_SIZE}"
# Set max upload size for php
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
sed -i "s/^upload_max_filesize = .*/upload_max_filesize = ${MAX_UPLOAD_SIZE}/" /etc/php81/php.ini
sed -i "s/^post_max_size = .*/post_max_size = ${MAX_UPLOAD_SIZE}/" /etc/php81/php.ini
# 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
function start() {
echo "Starting PHP & Nginx"
/etc/init.d/php8.1-fpm start &&
chmod 777 /run/php/php8.1-fpm.sock &&
php-fpm8 &&
nginx -g 'daemon off;'
}