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) <noreply@anthropic.com>
This commit is contained in:
PaulVua
2026-03-17 19:47:24 +01:00
parent 7b324f8ab8
commit ffe13d3639

View File

@@ -90,12 +90,32 @@ 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"
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 \/var\/www\/>/,/<\/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."
fi
# Add sudo authorization (prevent duplicate entries)
info "Setting up sudo authorization..."