#!/bin/bash
set -e

a2enmod rewrite headers expires 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/storage 2>/dev/null || true

chmod -R 775 /var/www/html/storage 2>/dev/null || true

echo "AETERNA - Apache configured successfully"
echo "DocumentRoot: /var/www/html/public"

exec apache2-foreground
