From ffe13d363940ec2377a42b9263ed93608b2961e7 Mon Sep 17 00:00:00 2001 From: PaulVua Date: Tue, 17 Mar 2026 19:47:24 +0100 Subject: [PATCH] Installation: AllowOverride All + PHP upload 50M pour mise a jour hors-ligne Configure Apache pour accepter les .htaccess (AllowOverride All) et augmente les limites PHP (upload_max_filesize=50M, post_max_size=55M) directement dans php.ini comme fallback. Necessaire pour l'upload de firmware .zip via la page admin. Co-Authored-By: Claude Opus 4.6 (1M context) --- installation_part1.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/installation_part1.sh b/installation_part1.sh index e3c177b..a78938d 100644 --- a/installation_part1.sh +++ b/installation_part1.sh @@ -90,13 +90,33 @@ fi info "Configuring Apache..." APACHE_CONF="/etc/apache2/sites-available/000-default.conf" if grep -q "DocumentRoot /var/www/nebuleair_pro_4g" "$APACHE_CONF"; then - warning "Apache configuration already set. Skipping." + warning "Apache DocumentRoot already set. Skipping." else sudo sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/nebuleair_pro_4g|' "$APACHE_CONF" - sudo systemctl reload apache2 - success "Apache configuration updated and reloaded." + success "Apache DocumentRoot updated." fi +# Enable AllowOverride for .htaccess (needed for PHP upload limits) +APACHE_MAIN_CONF="/etc/apache2/apache2.conf" +if grep -q "AllowOverride All" "$APACHE_MAIN_CONF"; then + warning "AllowOverride already configured. Skipping." +else + # Replace AllowOverride None with AllowOverride All for /var/www/ + sudo sed -i '//,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' "$APACHE_MAIN_CONF" + success "AllowOverride All enabled for /var/www/." +fi + +# Also increase PHP limits directly in php.ini as fallback +PHP_INI=$(php -r "echo php_ini_loaded_file();" 2>/dev/null) +if [[ -n "$PHP_INI" ]]; then + sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 50M/' "$PHP_INI" + sudo sed -i 's/post_max_size = .*/post_max_size = 55M/' "$PHP_INI" + success "PHP upload limits set to 50M in $PHP_INI" +fi + +sudo systemctl reload apache2 +success "Apache configuration updated and reloaded." + # Add sudo authorization (prevent duplicate entries) info "Setting up sudo authorization..." SUDOERS_FILE="/etc/sudoers"