#!/bin/bash set -e # Включаем mod_rewrite a2enmod rewrite 2>/dev/null || true # Устанавливаем права только на нужные директории, исключая .git find /var/www/html -maxdepth 1 -type d ! -name '.git' -exec chown -R www-data:www-data {} \; 2>/dev/null || true find /var/www/html -maxdepth 1 -type f -exec chown www-data:www-data {} \; 2>/dev/null || true # Устанавливаем права на ключевые директории chown -R www-data:www-data /var/www/html/app 2>/dev/null || true chown -R www-data:www-data /var/www/html/config 2>/dev/null || true chown -R www-data:www-data /var/www/html/public 2>/dev/null || true chown -R www-data:www-data /var/www/html/uploads 2>/dev/null || true echo "Apache configured successfully" # Запускаем Apache в foreground режиме exec apache2-foreground