diff --git a/scripts/install-wordpress.sh b/scripts/install-wordpress.sh index 9fdae3d..cacd3c5 100644 --- a/scripts/install-wordpress.sh +++ b/scripts/install-wordpress.sh @@ -607,6 +607,38 @@ if ! $SUDO_CMD $WP_EXECUTABLE core is-installed "${WP_RUN_ARGS[@]}"; then # Use determined $SUDO_CMD, $WP_EXECUTABLE, and $WP_RUN_ARGS $SUDO_CMD $WP_EXECUTABLE plugin delete akismet hello "${WP_RUN_ARGS[@]}" --quiet || warning "Could not delete default plugins (might not exist)." + # Install and activate LiteSpeed Cache plugin + info "Installing LiteSpeed Cache plugin..." + if $SUDO_CMD $WP_EXECUTABLE plugin install litespeed-cache "${WP_RUN_ARGS[@]}" --activate; then + success "LiteSpeed Cache plugin installed and activated successfully." + + # Configure basic LiteSpeed Cache settings + info "Configuring basic LiteSpeed Cache settings..." + + # Enable cache + $SUDO_CMD $WP_EXECUTABLE option update litespeed.conf.cache 1 "${WP_RUN_ARGS[@]}" || warning "Could not enable LiteSpeed cache" + + # Set cache TTL to 1 week (604800 seconds) + $SUDO_CMD $WP_EXECUTABLE option update litespeed.conf.cache-ttl_pub 604800 "${WP_RUN_ARGS[@]}" || warning "Could not set public cache TTL" + + # Enable CSS/JS optimization + $SUDO_CMD $WP_EXECUTABLE option update litespeed.conf.optm-css_min 1 "${WP_RUN_ARGS[@]}" || warning "Could not enable CSS minification" + $SUDO_CMD $WP_EXECUTABLE option update litespeed.conf.optm-js_min 1 "${WP_RUN_ARGS[@]}" || warning "Could not enable JS minification" + + # Enable image optimization (WebP) + $SUDO_CMD $WP_EXECUTABLE option update litespeed.conf.media-webp 1 "${WP_RUN_ARGS[@]}" || warning "Could not enable WebP conversion" + + # Enable lazy loading for images + $SUDO_CMD $WP_EXECUTABLE option update litespeed.conf.media-lazy 1 "${WP_RUN_ARGS[@]}" || warning "Could not enable lazy loading" + + # Enable browser cache + $SUDO_CMD $WP_EXECUTABLE option update litespeed.conf.cache-browser 1 "${WP_RUN_ARGS[@]}" || warning "Could not enable browser cache" + + success "LiteSpeed Cache basic configuration completed." + else + warning "Failed to install LiteSpeed Cache plugin. You can install it manually from the WordPress admin." + fi + # Ensure a default theme is activated (uses Twenty Twenty-Four or fallback to any available theme) info "Ensuring a default theme is activated..." if $SUDO_CMD $WP_EXECUTABLE theme is-installed twentytwentyfour "${WP_RUN_ARGS[@]}"; then @@ -810,6 +842,13 @@ printf " Database Name: ${GREEN}%s${NC}\n" "$DB_NAME" printf " Username: ${GREEN}%s${NC}\n" "$DB_USER" printf " Password: ${YELLOW}%s${NC} (Keep this safe!)\n" "$DB_PASSWORD" printf " Host: ${GREEN}%s${NC}\n" "$DB_HOST" +printf "\n" +printf "${YELLOW}LiteSpeed Cache Plugin:${NC}\n" +printf " Status: ${GREEN}Installed and Activated${NC}\n" +printf " Cache Enabled: ${GREEN}Yes${NC}\n" +printf " Cache TTL: ${GREEN}1 week (604800 seconds)${NC}\n" +printf " Optimizations: ${GREEN}CSS/JS minification, WebP, Lazy loading${NC}\n" +printf " Admin Panel: ${GREEN}https://%s/wp-admin/admin.php?page=litespeed${NC}\n" "$DOMAIN" if [[ "$PERFORM_DB_ROOT_RESET" == "true" ]]; then printf "\n${RED}IMPORTANT: The MySQL/MariaDB root password was reset during this process.${NC}\n" printf " New Root Pass: ${YELLOW}%s${NC} (Keep this safe!)\n" "$DB_ROOT_PASS"