Fixing vhost

This commit is contained in:
2025-08-08 11:25:21 -04:00
parent a1440fbff6
commit c56011addc

View File

@ -43,15 +43,16 @@ set -e
# Variables
DEBIAN_FRONTEND=noninteractive
# Add OpenLiteSpeed repository
wget -qO - https://repo.litespeed.sh | bash
# Update system
apt upgrade -y
apt update && apt upgrade -y
# Install essentials
apt install -y curl wget gnupg2 software-properties-common lsb-release unzip htop ufw fail2ban
# Add OpenLiteSpeed repository
# Needs to happen after curl is installed
wget -qO - https://repo.litespeed.sh | bash
# Required to compile PHP
apt install -y pkg-config build-essential libxml2 libxml2-dev php-dev autoconf automake libtool
# Required by virtual:world
@ -76,8 +77,11 @@ systemctl start lsws
sleep 2
# PHP and extensions
PHPVER='8.2'
apt install -y lsphp${PHPVER//./} lsphp${PHPVER//./}-{common,mysql,curl,imagick,intl,opcache,redis} php$PHPVER-cli
PHPVER='8.3'
apt install -y lsphp${PHPVER//./} lsphp${PHPVER//./}-{common,mysql,curl,imagick,intl,opcache,redis}
# Create a symlink that gives PHP CLI capability but uses the LSPHP version of PHP to coincide with server
ln -s /usr/local/lsws/lsphp83/bin/php /usr/local/bin/php
systemctl stop lsws
# Set lsphp as default for LiteSpeed
@ -161,7 +165,7 @@ 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
##sed -i "s|^[[:space:]]*vhMap[[:space:]]\\+Example[[:space:]]\\+| vhMap ${HTMLSITE_CONF} *|" /usr/local/lsws/conf/httpd_config.conf
# Delete the broken Example vhost
if [[ -e /usr/local/lsws/conf/vhosts/Example ]]; then
@ -209,8 +213,8 @@ listener SSL {
secure 1
keyFile /etc/ssl/litespeed/selfsigned.key
certFile /etc/ssl/litespeed/selfsigned.crt
vhRoot /var/www/html/
vhMap Example *
vhRoot /var/www/html
vhMap $HTMLSITE_CONF *
}
EOF