Some cleanup, not yet stable
This commit is contained in:
39
installer.sh
39
installer.sh
@ -28,25 +28,35 @@ if [[ "$1" == "--purge" ]]; then
|
||||
rm -rf /var/log/lsws
|
||||
rm -rf /etc/lsws
|
||||
|
||||
# Remove user and group if they exist
|
||||
# Remove admin user
|
||||
userdel -r lsadm 2>/dev/null || true
|
||||
groupdel nogroup 2>/dev/null || true
|
||||
|
||||
echo "LiteSpeed Server Appliance has been purged."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "LiteSpeed Server Appliance Installer"
|
||||
echo "By Robbie Ferguson"
|
||||
|
||||
set -e
|
||||
|
||||
# Variables
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Add OpenLiteSpeed repository
|
||||
wget -qO - https://repo.litespeed.sh | bash
|
||||
|
||||
# Update system
|
||||
apt update && apt upgrade -y
|
||||
apt upgrade -y
|
||||
|
||||
# Install essentials
|
||||
apt install -y curl wget gnupg2 software-properties-common lsb-release unzip htop ufw fail2ban
|
||||
|
||||
# Required to compile PHP
|
||||
apt install -y pkg-config build-essential libxml2 libxml2-dev php-dev autoconf automake libtool
|
||||
# Required by virtual:world
|
||||
apt install -y libssl-dev libsqlite3-dev zlib1g-dev libcurl4-openssl-dev libpng-dev libonig-dev libzip-dev
|
||||
|
||||
# MariaDB
|
||||
apt install -y mariadb-server mariadb-client
|
||||
|
||||
@ -58,8 +68,7 @@ DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
|
||||
FLUSH PRIVILEGES;
|
||||
EOF
|
||||
|
||||
# OpenLiteSpeed repo and install
|
||||
wget -qO - https://repo.litespeed.sh | bash
|
||||
# Install OpenLiteSpeed
|
||||
apt install -y openlitespeed
|
||||
|
||||
# Start OpenLiteSpeed once to initialize directories
|
||||
@ -67,12 +76,12 @@ systemctl start lsws
|
||||
sleep 2
|
||||
|
||||
# PHP and extensions
|
||||
PHPVER=83
|
||||
apt install -y lsphp$PHPVER lsphp$PHPVER-common lsphp$PHPVER-mysql lsphp$PHPVER-curl lsphp$PHPVER-imagick lsphp$PHPVER-intl lsphp$PHPVER-opcache lsphp$PHPVER-redis
|
||||
PHPVER='8.2'
|
||||
apt install -y lsphp${PHPVER//./} lsphp${PHPVER//./}-{common,mysql,curl,imagick,intl,opcache,redis} php$PHPVER-cli
|
||||
|
||||
systemctl stop lsws
|
||||
# Set lsphp as default for LiteSpeed
|
||||
sed -i "s|path .*|path /usr/local/lsws/lsphp$PHPVER/bin/php|" /usr/local/lsws/conf/httpd_config.conf
|
||||
sed -i "s|path .*|path /usr/local/lsws/lsphp${PHPVER//./}/bin/php|" /usr/local/lsws/conf/httpd_config.conf
|
||||
systemctl start lsws
|
||||
|
||||
# Enable GZIP and Brotli compression
|
||||
@ -118,12 +127,12 @@ index {
|
||||
}
|
||||
|
||||
scripthandler {
|
||||
add lsapi:lsphp${PHPVER} php
|
||||
add lsapi:lsphp${PHPVER//./} php
|
||||
}
|
||||
|
||||
extprocessor lsphp${PHPVER} {
|
||||
extprocessor lsphp${PHPVER//./} {
|
||||
type lsapi
|
||||
address uds://tmp/lshttpd/lsphp${PHPVER}.sock
|
||||
address uds://tmp/lshttpd/lsphp${PHPVER//./}.sock
|
||||
maxConns 35
|
||||
env PHP_LSAPI_CHILDREN=35
|
||||
env LSAPI_AVOID_FORK=200M
|
||||
@ -132,7 +141,7 @@ extprocessor lsphp${PHPVER} {
|
||||
persistConn 1
|
||||
respBuffer 0
|
||||
autoStart 1
|
||||
path /usr/local/lsws/lsphp${PHPVER}/bin/php
|
||||
path /usr/local/lsws/lsphp${PHPVER//./}/bin/php
|
||||
backlog 100
|
||||
instances 1
|
||||
priority 0
|
||||
@ -147,6 +156,10 @@ phpIniOverride {
|
||||
}
|
||||
EOF
|
||||
|
||||
chown -R lsadm:nogroup /usr/local/lsws/conf/vhosts/${HTMLSITE_CONF}
|
||||
chmod 700 /usr/local/lsws/conf/vhosts/${HTMLSITE_CONF}
|
||||
chmod 600 /usr/local/lsws/conf/vhosts/${HTMLSITE_CONF}/vhconf.conf
|
||||
|
||||
# Map listeners to html-site instead of Example
|
||||
sed -i 's/vhMap.*Example.*/vhMap ${HTMLSITE_CONF} */' /usr/local/lsws/conf/httpd_config.conf
|
||||
|
||||
@ -215,7 +228,7 @@ ufw --force enable
|
||||
systemctl restart lsws
|
||||
|
||||
# Print completion message
|
||||
echo "\nLiteSpeed Server Appliance installed successfully!"
|
||||
echo "LiteSpeed Server Appliance installed successfully!"
|
||||
echo "Default Web Root: /var/www/html"
|
||||
echo "Access OpenLiteSpeed WebAdmin at: https://<your-server-ip>:7080"
|
||||
echo "Default admin login: admin / 123456 (change this immediately)"
|
||||
|
Reference in New Issue
Block a user