add auto restart to nginx and php
All checks were successful
/ docker (push) Successful in 1m57s

This commit is contained in:
Lee 2023-07-07 23:43:14 +01:00
parent 5644761cee
commit aa606b5924

@ -26,8 +26,15 @@ sed -i "s/^post_max_size = .*/post_max_size = ${MAX_UPLOAD_SIZE}/" /etc/php/8.1/
# Set max upload size for nginx # 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 sed -i "s/client_max_body_size 500M;/client_max_body_size ${MAX_UPLOAD_SIZE};/" /etc/nginx/nginx.conf
# Start Nginx function start() {
echo "Starting PHP & Nginx" echo "Starting PHP & Nginx"
/etc/init.d/php8.1-fpm start && /etc/init.d/php8.1-fpm start &&
chmod 777 /run/php/php8.1-fpm.sock && chmod 777 /run/php/php8.1-fpm.sock &&
nginx -g 'daemon off;' nginx -g 'daemon off;'
}
# Start Nginx and retry if it fails
until start; do
echo "Nginx failed to start, retrying in 5 seconds..."
sleep 5
done