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"