feat: convert WordOps from Nginx to OpenLiteSpeed + LSPHP + LSCache
Some checks failed
CI / test WordOps (ubuntu-22.04) (push) Has been cancelled
CI / test WordOps (ubuntu-24.04) (push) Has been cancelled

Complete conversion of the WordOps stack from Nginx + PHP-FPM to
OpenLiteSpeed + LSPHP + LSCache. This is a full rewrite across all 7
phases of the codebase:

- Foundation: OLS paths, variables, services, removed pynginxconfig dep
- Templates: 11 new OLS mustache templates, removed nginx-specific ones
- Stack: stack_pref, stack, stack_services, stack_upgrade, stack_migrate
- Site: site_functions, site, site_create, site_update
- Plugins: debug, info, log, clean rewritten for OLS
- SSL/ACME: acme.sh deploy uses lswsctrl, OLS vhssl blocks
- Other: secure, backup, clone, install script

Additional features:
- Debian 13 (trixie) support
- PHP 8.5 support
- WP Fort Knox mu-plugin integration (wo secure --lockdown/--unlock)
- --nginx CLI flag preserved for backward compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 18:55:16 +01:00
parent aa127070e1
commit fa5bf17eb8
42 changed files with 2328 additions and 2926 deletions

191
install
View File

@@ -141,7 +141,7 @@ wo_init_variables() {
readonly TIME_FORMAT='%d-%b-%Y-%H%M%S'
TIME=$(date +"$TIME_FORMAT")
readonly TIME
readonly NGINX_BACKUP_FILE="/var/lib/wo-backup/nginx-backup.$TIME.tar.zst"
readonly OLS_BACKUP_FILE="/var/lib/wo-backup/ols-backup.$TIME.tar.zst"
readonly EE_BACKUP_FILE="/var/lib/wo-backup/ee-backup.$TIME.tar.zst"
readonly WO_BACKUP_FILE="/var/lib/wo-backup/wo-backup.$TIME.tar.zst"
@@ -168,9 +168,9 @@ wo_check_distro() {
wo_lib_echo_fail "Feel free to open a pull-request if you want to add support for another Linux distributions"
exit 100
else
check_wo_linux_distro=$(lsb_release -sc | grep -E "buster|focal|jammy|bullseye|bookworm|noble")
check_wo_linux_distro=$(lsb_release -sc | grep -E "buster|focal|jammy|bullseye|bookworm|trixie|noble")
if [ -z "$check_wo_linux_distro" ]; then
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu 20.04/22.04/24.04 LTS, Debian 10.x/11.x/12.x and Raspbian 10x./11.x/12.x \n
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu 20.04/22.04/24.04 LTS, Debian 10.x/11.x/12.x/13.x and Raspbian 10x./11.x/12.x/13.x \n
You can bypass this warning by adding the flag --force to the install command"
exit 100
fi
@@ -250,13 +250,8 @@ wo_download_gpg_keys() {
# mariadb
curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'
# nginx
if [ "$wo_linux_distro" == "Debian" ]; then
curl -fsSL "https://raw.githubusercontent.com/WordOps/WordOps/refs/heads/master/repo.key" | gpg --dearmor | tee /usr/share/keyrings/wordops-archive-keyring.gpg >/dev/null 2>&1
fi
if [ "$wo_linux_distro" == "Raspbian" ]; then
curl -fsSL "https://download.opensuse.org/repositories/home:virtubox:WordOps/Raspbian_$wo_distro_version/Release.key" | gpg --dearmor | tee /usr/share/keyrings/wordops-archive-keyring.gpg >/dev/null 2>&1
fi
# openlitespeed
curl -fsSL https://rpms.litespeedtech.com/debian/lst_debian_repo.gpg | gpg --dearmor | tee /usr/share/keyrings/openlitespeed-archive-keyring.gpg >/dev/null 2>&1
}
wo_update_repo() {
@@ -283,10 +278,9 @@ wo_update_repo() {
if grep -q redis /etc/apt/sources.list.d/wo-repo.list; then
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $wo_linux_codename main" >/etc/apt/sources.list.d/redis.list
fi
# properly define WordOps nginx repository
# properly define OpenLiteSpeed repository
if grep -q WordOps /etc/apt/sources.list.d/wo-repo.list; then
wo_repo=$(grep WordOps /etc/apt/sources.list.d/wo-repo.list | awk -F\ '{ print $2 }')
echo "deb [signed-by=/usr/share/keyrings/wordops-archive-keyring.gpg] $wo_repo /" >/etc/apt/sources.list.d/wordops.list
echo "deb [signed-by=/usr/share/keyrings/openlitespeed-archive-keyring.gpg] http://rpms.litespeedtech.com/debian/ $wo_linux_codename main" >/etc/apt/sources.list.d/openlitespeed.list
fi
# cleanup wo-repo.list
if grep -Eqv "WordOps|mariadb|sury|redis" /etc/apt/sources.list.d/wo-repo.list; then
@@ -328,7 +322,7 @@ wo_sync_db() {
# Copy ee database
cp /var/lib/ee/ee.db /var/lib/wo/dbase.db
else
if [ -d /etc/nginx/sites-available ] && [ -d /var/www ]; then
if [ -d /usr/local/lsws/conf/vhosts ] && [ -d /var/www ]; then
# Create an empty database for WordOps
echo "CREATE TABLE sites (
@@ -350,58 +344,40 @@ wo_sync_db() {
php_version VARCHAR
);" | sqlite3 /var/lib/wo/dbase.db
# Check site is enable/live or disable
AV_SITES="$(basename -a /etc/nginx/sites-available/* | grep -v default)"
for site in $AV_SITES; do
if [ -h "/etc/nginx/sites-enabled/$site" ]; then
wo_site_status='1'
else
wo_site_status='0'
fi
# Check OLS vhosts
if [ -d /usr/local/lsws/conf/vhosts ]; then
for vhost_dir in /usr/local/lsws/conf/vhosts/*/; do
site=$(basename "$vhost_dir")
[ "$site" = "22222" ] && continue
[ "$site" = "*" ] && continue
# Acquire information about the current nginx configuration
# Check if vhost is mapped in httpd_config.conf (enabled)
if grep -q "map.*$site" /usr/local/lsws/conf/httpd_config.conf 2>/dev/null; then
wo_site_status='1'
else
wo_site_status='0'
fi
wo_site_current_type=$(grep "common/" "/etc/nginx/sites-available/$site" | awk -F "/" '{print $2}')
if echo "$wo_site_current_type" | grep -q "redis"; then
wo_site_current_cache="wpredis"
elif echo "$wo_site_current_type" | grep -q wpsc; then
wo_site_current_cache="wpsc"
elif echo "$wo_site_current_type" | grep -q wpfc; then
wo_site_current_cache="wpfc"
else
# Default cache type for OLS is LSCache
wo_site_current_cache="basic"
fi
if echo "$wo_site_current_type" | grep -q wp; then
if echo "$wo_site_current_type" | grep -q wpsubdir; then
wo_site_current="wpsubdir"
elif echo "$wo_site_current_type" | grep -q wpsudomain; then
wo_site_current="wpsubdomain"
else
# Determine site type
if [ -f "/var/www/${site}/htdocs/wp-config.php" ]; then
wo_site_current="wp"
fi
else
if echo "$wo_site_current_type" | grep -q location; then
wo_site_current="proxy"
elif echo "$wo_site_current_type" | grep -q php; then
wo_site_current="html"
elif [ -f "/var/www/${site}/wo-config.php" ]; then
wo_site_current="mysql"
else
if [ -f "/var/www/${site}/ee-config.php" ] || [ -f "/var/www/${site}/wo-config.php" ]; then
wo_site_current="mysql"
else
wo_site_current="php"
fi
wo_site_current="php"
fi
fi
wo_webroot="/var/www/$site"
wo_webroot="/var/www/$site"
# Import the configuration into the WordOps SQLite database
echo "INSERT INTO sites (sitename, site_type, cache_type, site_path, is_enabled, is_ssl, storage_fs, storage_db)
# Import the configuration into the WordOps SQLite database
echo "INSERT INTO sites (sitename, site_type, cache_type, site_path, is_enabled, is_ssl, storage_fs, storage_db)
VALUES (\"$site\", \"$wo_site_current\", \"$wo_site_current_cache\", \"$wo_webroot\", \"$wo_site_status\", 0, 'ext4', 'mysql');" | sqlite3 /var/lib/wo/dbase.db
done
done
fi
fi
fi
@@ -532,6 +508,8 @@ wo_install() {
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.2.1#egg=python-apt
elif [ "$wo_distro_codename" = "bookworm" ]; then
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.5.3#egg=python-apt
elif [ "$wo_distro_codename" = "trixie" ]; then
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.9.y#egg=python-apt
else
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt
fi
@@ -599,6 +577,8 @@ wo_travis_install() {
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.2.1#egg=python-apt
elif [ "$wo_distro_codename" = "bookworm" ]; then
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.5.3#egg=python-apt
elif [ "$wo_distro_codename" = "trixie" ]; then
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.9.y#egg=python-apt
else
/opt/wo/bin/pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt
fi
@@ -626,84 +606,44 @@ wo_travis_install() {
deactivate
}
wo_upgrade_nginx() {
wo_upgrade_ols() {
local wo_linux_distro
wo_linux_distro=$(lsb_release -is)
local wo_distro_version
wo_distro_version=$(lsb_release -sc)
if [ -d /var/lib/wo-backup/nginx ]; then
/bin/tar -I zstd "$NGINX_BACKUP_FILE" /var/lib/wo-backup/nginx
rm -rf /var/lib/wo-backup/nginx
# backup OLS conf
if [ -d /usr/local/lsws/conf ]; then
mkdir -p /var/lib/wo-backup/ols
/usr/bin/rsync -a --noatime /usr/local/lsws/conf/ /var/lib/wo-backup/ols/
fi
# backup nginx conf
if [ -d /etc/nginx ]; then
/usr/bin/rsync -a --noatime /etc/nginx/ /var/lib/wo-backup/nginx/
if [ -d /var/lib/wo-backup/ols ]; then
/bin/tar -I zstd -cf "$OLS_BACKUP_FILE" /var/lib/wo-backup/ols
rm -rf /var/lib/wo-backup/ols
fi
if [ -d /etc/php ]; then
/usr/bin/rsync -a --noatime /etc/php/ /var/lib/wo-backup/php/
fi
# chec if the package nginx-ee is installed
CHECK_NGINX_EE=$(dpkg --list | grep nginx-ee)
CHECK_PHP72=$(command -v php-fpm7.2)
# install new nginx package
if {
if [ -n "$CHECK_NGINX_EE" ]; then
if [ -x /usr/local/bin/wo ]; then
[ -f /etc/apt/preferences.d/nginx-block ] && { mv /etc/apt/preferences.d/nginx-block /var/lib/wo/tmp/nginx-block; }
# stop nginx
service nginx stop
# remove previous package
apt-mark unhold nginx-ee nginx-common nginx-custom
apt-get autoremove nginx-ee nginx-common nginx-custom --allow-change-held-packages --purge -qq
# remove previous php-fpm pool configuration
if [ -n "$CHECK_PHP72" ]; then
apt-get purge php7.2-fpm -y -qq
rm -f /etc/php/7.2/fpm/pool.d/{www.conf,www-two.conf,debug.conf}
fi
if [ -d /etc/nginx ]; then
rm -rf /etc/nginx
fi
/usr/local/bin/wo stack install --nginx --php
rm -f /etc/nginx/common/acl.conf /etc/nginx/htpasswd-wo
/usr/bin/rsync -au --noatime /var/lib/wo-backup/nginx/ /etc/nginx/
/usr/local/bin/wo stack upgrade --nginx --force
fi
# Check if old nginx-ee/nginx-custom is installed and migrate to OLS
CHECK_NGINX_EE=$(dpkg --list 2>/dev/null | grep -E "nginx-ee|nginx-custom")
if [ -n "$CHECK_NGINX_EE" ]; then
if [ -x /usr/local/bin/wo ]; then
# stop and remove nginx
service nginx stop 2>/dev/null
apt-mark unhold nginx-ee nginx-common nginx-custom 2>/dev/null
apt-get autoremove nginx-ee nginx-common nginx-custom --allow-change-held-packages --purge -qq 2>/dev/null
# install OLS
/usr/local/bin/wo stack install --nginx --php
fi
}; then
# restore sites and configuration
[ -f /etc/nginx/htpasswd-ee ] && { cp -f /etc/nginx/htpasswd-ee /etc/nginx/htpasswd-wo; }
sed -i "s/locations.conf/locations-wo.conf/" /etc/nginx/sites-available/*
sed -i "s/locations-php7.conf/locations-wo.conf/" /etc/nginx/sites-available/*
sed -i "s/locations-php71.conf/locations-wo.conf/" /etc/nginx/sites-available/*
sed -i "s/locations-php72.conf/locations-wo.conf/" /etc/nginx/sites-available/*
sed -i "s/locations-php73.conf/locations-wo.conf/" /etc/nginx/sites-available/*
sed -i "s/htpasswd-ee/htpasswd-wo/" /etc/nginx/common/acl.conf
sed -i 's/ssl on;/#ssl on;/' /var/www/*/conf/nginx/ssl.conf
fi
# update redis.conf headers
if [ -f /etc/nginx/common/redis.conf ]; then
sed -i "s/X-Cache /X-SRCache-Fetch-Status /g" /etc/nginx/common/redis.conf
sed -i "s/X-Cache-2 /X-SRCache-Store-Status /g" /etc/nginx/common/redis.conf
fi
VERIFY_NGINX_CONFIG=$(nginx -t 2>&1 | grep failed)
# check if nginx -t do not return errors
if [ -z "$VERIFY_NGINX_CONFIG" ]; then
systemctl stop nginx
systemctl start nginx
else
VERIFY_NGINX_BUCKET=$(nginx -t 2>&1 | grep "server_names_hash_bucket_size")
if [ -n "$VERIFY_NGINX_BUCKET" ]; then
sed -i "s/# server_names_hash_bucket_size 64;/server_names_hash_bucket_size 128;/g" /etc/nginx/nginx.conf
# Verify OLS config and restart
if [ -x /usr/local/lsws/bin/openlitespeed ]; then
VERIFY_OLS_CONFIG=$(/usr/local/lsws/bin/openlitespeed -t 2>&1 | grep -i "error")
if [ -z "$VERIFY_OLS_CONFIG" ]; then
/usr/local/lsws/bin/lswsctrl restart 2>/dev/null
else
wo_lib_echo_fail "OLS configuration test failed. Check /usr/local/lsws/logs/error.log"
fi
systemctl stop nginx
systemctl start nginx
fi
[ -f /var/lib/wo/tmp/nginx-block ] && { mv /var/lib/wo/tmp/nginx-block /etc/apt/preferences.d/nginx-block; }
return 0
}
@@ -731,14 +671,15 @@ wo_update_latest() {
wo_backup_ee() {
local BACKUP_EE=""
[ -d /etc/nginx ] && { BACKUP_EE="$BACKUP_EE /etc/nginx"; }
[ -d /usr/local/lsws/conf ] && { BACKUP_EE="$BACKUP_EE /usr/local/lsws/conf"; }
[ -d /etc/letsencrypt ] && { BACKUP_EE="$BACKUP_EE /etc/letsencrypt"; }
/bin/tar -I zstd -cf "$EE_BACKUP_FILE" /usr/local/bin/ee /usr/lib/ee/templates /etc/ee /var/lib/ee "$BACKUP_EE"
return 0
}
wo_backup_wo() {
if [ -d /etc/nginx ] && [ -d /etc/wo ] && [ -d /var/lib/wo ]; then
/bin/tar -I zstd -cf "$WO_BACKUP_FILE" /etc/nginx /etc/wo /var/lib/wo
if [ -d /usr/local/lsws/conf ] && [ -d /etc/wo ] && [ -d /var/lib/wo ]; then
/bin/tar -I zstd -cf "$WO_BACKUP_FILE" /usr/local/lsws/conf /etc/wo /var/lib/wo
fi
return 0
}
@@ -929,7 +870,7 @@ else
_run wo_travis_install "Installing WordOps"
fi
if [ -x /usr/local/bin/ee ]; then
_run wo_upgrade_nginx "Upgrading Nginx"
_run wo_upgrade_ols "Upgrading to OpenLiteSpeed"
_run wo_clean_ee "Cleaning previous EasyEngine install"
fi
_run wo_install_acme_sh "Running post-install steps"
@@ -952,8 +893,8 @@ else
echo
version_to_check="v3.21"
if echo "$wo_version_new" | grep -q "$version_to_check"; then
wo_lib_echo "To upgrade Nginx package and configuration for HTTP/3 QUIC, use the following command"
wo_lib_echo_info "wo stack migrate --nginx"
wo_lib_echo "To upgrade OpenLiteSpeed package and configuration, use the following command"
wo_lib_echo_info "wo stack upgrade --nginx"
fi
echo
wo_lib_echo "To upgrade WordOps web stacks, you can use the command:"