41 lines
1.0 KiB
Bash
41 lines
1.0 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# Update configurations from .env
|
|
echo "Updating configurations from .env..."
|
|
/usr/local/bin/update_configs.sh
|
|
|
|
# Check if PHP is enabled
|
|
if [ "${ENABLE_PHP}" = "1" ]; then
|
|
echo "PHP is enabled, starting PHP-FPM..."
|
|
# Get PHP version from environment
|
|
PHP_VERSION=${PHP_VERSION:-8.3}
|
|
|
|
# Start PHP-FPM
|
|
/etc/init.d/php${PHP_VERSION}-fpm start
|
|
|
|
# Wait for PHP-FPM to be ready
|
|
until [ -S /run/php/php${PHP_VERSION}-fpm.sock ]; do
|
|
echo "Waiting for PHP-FPM socket..."
|
|
sleep 1
|
|
done
|
|
echo "PHP-FPM is ready!"
|
|
fi
|
|
|
|
# Link sites in sites-available to sites-enabled
|
|
echo "Linking available sites..."
|
|
/usr/local/bin/link_sites.sh
|
|
|
|
# Generate self-signed SSL certificates if no certificates exist
|
|
if [ ! -d "/etc/nginx/ssl" ] || [ -z "$(ls -A /etc/nginx/ssl)" ]; then
|
|
echo "Generating self-signed SSL certificates..."
|
|
/usr/local/bin/generate_self_signed_ssl.sh
|
|
fi
|
|
|
|
# Test nginx configuration
|
|
echo "Testing Nginx configuration..."
|
|
nginx -t
|
|
|
|
# Start Nginx
|
|
echo "Starting Nginx..."
|
|
nginx -g 'daemon off;' |