add support for multiple php versions
This commit is contained in:
parent
48871ee4fd
commit
812fa2dd01
|
@ -13,11 +13,12 @@ help()
|
||||||
thisfilename=$(basename -- "$0")
|
thisfilename=$(basename -- "$0")
|
||||||
echo "Add virtualhost to this server."
|
echo "Add virtualhost to this server."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -d <domain> -u <username> [-h]"
|
echo "usage: $thisfilename -d <domain> -u <username> [-f <fpm>] [-h]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h Print this help."
|
echo " -h Print this help."
|
||||||
echo " -d <domain> Domain name to add as a VirtualHost. www. subdomain is automatically aliased."
|
echo " -d <domain> Domain name to add as a VirtualHost. www. subdomain is automatically aliased."
|
||||||
echo " -u <username> Username to install VirtualHost for. Username must already exist."
|
echo " -u <username> Username to install VirtualHost for. Username must already exist."
|
||||||
|
echo " -f <fpm> PHP-FPM version to enable. Optional, defaults to default PHP version."
|
||||||
echo " If need be run vhost-user-add.sh first."
|
echo " If need be run vhost-user-add.sh first."
|
||||||
echo " Or use vhost-deploy.sh instead to automatically generate username."
|
echo " Or use vhost-deploy.sh instead to automatically generate username."
|
||||||
}
|
}
|
||||||
|
@ -36,6 +37,12 @@ if [[ -z $username ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set php-fpm to default php version, if not otherwise specified
|
||||||
|
if [[ -z $fpm ]]; then
|
||||||
|
vhost::set-phpVersion
|
||||||
|
fpm=$phpVersion
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -d /home/$username ]]; then
|
if [[ ! -d /home/$username ]]; then
|
||||||
echo "home dir for $username does not exist"
|
echo "home dir for $username does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -65,17 +72,14 @@ if [[ -d /usr/jails/$username ]]; then
|
||||||
install -d -o $username -g $username -m 755 /usr/jails/$username/srv/www/$domain
|
install -d -o $username -g $username -m 755 /usr/jails/$username/srv/www/$domain
|
||||||
mount --bind /srv/www/$domain /usr/jails/$username/srv/www/$domain
|
mount --bind /srv/www/$domain /usr/jails/$username/srv/www/$domain
|
||||||
echo "/srv/www/$domain /usr/jails/$username/srv/www/$domain none bind 0 0" >> /etc/fstab.jails
|
echo "/srv/www/$domain /usr/jails/$username/srv/www/$domain none bind 0 0" >> /etc/fstab.jails
|
||||||
|
# ensure php-fpm is chrooted. should have already been set when user was initially jailed
|
||||||
|
if [[ -f /etc/php/$fpm/fpm/pool.d/$username.conf ]]; then
|
||||||
|
if ! /bin/grep -q "^chroot" /etc/php/$fpm/fpm/pool.d/$username.conf; then
|
||||||
|
echo "chroot = /usr/jails/$username" >> /etc/php/$fpm/fpm/pool.d/$username.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set sendmail_path in php-fpm, but only if not already set
|
|
||||||
## disabled, now relying on defaults (user@fqdn) with .forward (/home/user/.forward)
|
|
||||||
## vhost::set-phpVersion
|
|
||||||
## if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
|
||||||
## if ! /bin/grep -q "^php_admin_value\[sendmail_path\]" /etc/php/$phpVersion/fpm/pool.d/$username.conf; then
|
|
||||||
## echo "php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -fwebmaster@$domain" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
|
||||||
## fi
|
|
||||||
## fi
|
|
||||||
|
|
||||||
# create & enable apache config
|
# create & enable apache config
|
||||||
/usr/local/bin/vhost-enable.sh -d $domain -m VHostHTTP
|
/usr/local/bin/vhost-enable.sh -d $domain -m VHostHTTP -f $fpm
|
||||||
|
|
|
@ -13,13 +13,14 @@ help()
|
||||||
thisfilename=$(basename -- "$0")
|
thisfilename=$(basename -- "$0")
|
||||||
echo "Add virtualhost to this server, including shell user and MySQL database."
|
echo "Add virtualhost to this server, including shell user and MySQL database."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -d <domain> [-u <username>] [-p <password>] [-x <fpmmax>] [-j <0|1>] [-w <0|1>] [-h]"
|
echo "usage: $thisfilename -d <domain> [-u <username>] [-p <password>] [-x <fpmmax>] [-f <fpm>] [-j <0|1>] [-w <0|1>] [-h]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h Print this help."
|
echo " -h Print this help."
|
||||||
echo " -d <domain> Domain name of VirtualHost to remove."
|
echo " -d <domain> Domain name of VirtualHost to remove."
|
||||||
echo " -u <username> Username to use for this virtualhost. Optional, defaults to first 8 alphanumeric characters of virtualhost."
|
echo " -u <username> Username to use for this virtualhost. Optional, defaults to first 8 alphanumeric characters of virtualhost."
|
||||||
echo " -p <password> Password for username. Optional, random password generated if none specified."
|
echo " -p <password> Password for username. Optional, random password generated if none specified."
|
||||||
echo " -x <fpmmax> PHP-FPM pm.max_children. Optional, defaults to 4, recommended range 2-12 on Shared Server."
|
echo " -x <fpmmax> PHP-FPM pm.max_children. Optional, defaults to 4, recommended range 2-12 on Shared Server."
|
||||||
|
echo " -f <fpm> PHP-FPM version to enable. Optional, defaults to default PHP version."
|
||||||
echo " -j <0|1> Whether or not to jail the user. 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
echo " -j <0|1> Whether or not to jail the user. 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
||||||
echo " -w <0|1> Write user info to /home/username/.passwd. 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
echo " -w <0|1> Write user info to /home/username/.passwd. 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
||||||
exit
|
exit
|
||||||
|
@ -117,8 +118,14 @@ if ! grep -q "^$username:" /etc/passwd; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set php-fpm to default php version, if not otherwise specified
|
||||||
|
if [[ -z $fpm ]]; then
|
||||||
|
vhost::set-phpVersion
|
||||||
|
fpm=$phpVersion
|
||||||
|
fi
|
||||||
|
|
||||||
# add virtualhost
|
# add virtualhost
|
||||||
/usr/local/bin/vhost-add.sh -d $domain -u $username > /dev/null 2>&1
|
/usr/local/bin/vhost-add.sh -d $domain -u $username -f $fpm > /dev/null 2>&1
|
||||||
|
|
||||||
# add mysql database
|
# add mysql database
|
||||||
/usr/local/bin/vhost-mysql-db-add.sh -d $domain> /dev/null 2>&1
|
/usr/local/bin/vhost-mysql-db-add.sh -d $domain> /dev/null 2>&1
|
||||||
|
|
|
@ -13,11 +13,12 @@ help()
|
||||||
thisfilename=$(basename -- "$0")
|
thisfilename=$(basename -- "$0")
|
||||||
echo "Enable Apache config for virtualhost."
|
echo "Enable Apache config for virtualhost."
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -d <domain> [-m <macro>] [-o <alias>|<redirect_url>] [-h]"
|
echo "usage: $thisfilename -d <domain> [-m <macro>] [-f <fpm>] [-o <alias>|<redirect_url>] [-h]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h Print this help."
|
echo " -h Print this help."
|
||||||
echo " -d <domain> Domain name of VirtualHost to add."
|
echo " -d <domain> Domain name of VirtualHost to add."
|
||||||
echo " -m <macro> Name of Apache macro to apply. Optional, script will attempt to autoselect if possible."
|
echo " -m <macro> Name of Apache macro to apply. Optional, script will attempt to autoselect if possible."
|
||||||
|
echo " -f <fpm> PHP-FPM version to enable. Optional, defaults to default PHP version, only used by VHost macros."
|
||||||
echo " -o <option> Alias or Redirect URL if specified macro requires one."
|
echo " -o <option> Alias or Redirect URL if specified macro requires one."
|
||||||
echo " For Aliases & Redirects '-d <domain>' is the alias/redirect domain,"
|
echo " For Aliases & Redirects '-d <domain>' is the alias/redirect domain,"
|
||||||
echo " and '-o <option>' is the existing VirtualHost to alias/redirect to."
|
echo " and '-o <option>' is the existing VirtualHost to alias/redirect to."
|
||||||
|
@ -25,7 +26,7 @@ help()
|
||||||
echo " Available Apache Macros with examples:"
|
echo " Available Apache Macros with examples:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " vhost-enable.sh -m VHostHTTP -d example.com"
|
echo " vhost-enable.sh -m VHostHTTP -d example.com"
|
||||||
echo " vhost-enable.sh -m VHostHTTPS -d example.com"
|
echo " vhost-enable.sh -m VHostHTTPS -d example.com -f 8.3"
|
||||||
echo " vhost-enable.sh -m VHostHTTPSVarnish -d example.com"
|
echo " vhost-enable.sh -m VHostHTTPSVarnish -d example.com"
|
||||||
echo " vhost-enable.sh -m VHostSubdomainHTTP -d staging.example.com"
|
echo " vhost-enable.sh -m VHostSubdomainHTTP -d staging.example.com"
|
||||||
echo " vhost-enable.sh -m VHostSubdomainHTTPS -d staging.example.com"
|
echo " vhost-enable.sh -m VHostSubdomainHTTPS -d staging.example.com"
|
||||||
|
@ -79,7 +80,7 @@ if [[ "$macro" == *"HTTPS"* ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set username for all VHost macros
|
# set username & php-fpm for all VHost macros
|
||||||
if [[ "$macro" == *"VHost"* ]]; then
|
if [[ "$macro" == *"VHost"* ]]; then
|
||||||
# check for vhost dir
|
# check for vhost dir
|
||||||
if [[ "$macro" == *"Alias"* ]]; then
|
if [[ "$macro" == *"Alias"* ]]; then
|
||||||
|
@ -110,7 +111,27 @@ if [[ "$macro" == *"VHost"* ]]; then
|
||||||
if [[ -d "/srv/www/$vhost" ]]; then
|
if [[ -d "/srv/www/$vhost" ]]; then
|
||||||
# get and set $username
|
# get and set $username
|
||||||
username=$(stat -c '%U' /srv/www/$vhost)
|
username=$(stat -c '%U' /srv/www/$vhost)
|
||||||
macro_vhost_line="$macro_vhost_line $vhost $username"
|
# use default phpVersion for fpm if not otherwise specified
|
||||||
|
vhost::set-phpVersion
|
||||||
|
if [[ -z $fpm ]]; then
|
||||||
|
fpm=$phpVersion
|
||||||
|
else
|
||||||
|
# not using default php-fpm version, make sure config exists for specified version
|
||||||
|
if [[ ! -f /etc/php/$fpm/fpm/pool.d/$username.conf ]]; then
|
||||||
|
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
||||||
|
cat /etc/php/$phpVersion/fpm/pool.d/$username.conf |sed "s|php$phpVersion|php$fpm|g" > /etc/php/$fpm/fpm/pool.d/$username.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
macro_vhost_line="$macro_vhost_line $vhost $username $fpm"
|
||||||
|
# if vhost is jailed ensure php-fpm is chrooted. should have already been set when user was initially jailed
|
||||||
|
if [[ -d /usr/jails/$username/srv/www/$domain ]]; then
|
||||||
|
if [[ -f /etc/php/$fpm/fpm/pool.d/$username.conf ]]; then
|
||||||
|
if ! /bin/grep -q "^chroot" /etc/php/$fpm/fpm/pool.d/$username.conf; then
|
||||||
|
echo "chroot = /usr/jails/$username" >> /etc/php/$fpm/fpm/pool.d/$username.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "VirtualHost dir for $vhost does not exist."
|
echo "VirtualHost dir for $vhost does not exist."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -61,10 +61,13 @@ if [[ -d /srv/www/$domain ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# php config
|
# php config
|
||||||
vhost::set-phpVersion
|
vhost::set-phpVersionArray
|
||||||
|
for phpVersion in "${phpVersionArray[@]}"
|
||||||
|
do
|
||||||
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
||||||
cp --archive --parents /etc/php/$phpVersion/fpm/pool.d/$username.conf /srv/www/$domain/.exp/
|
cp --archive --parents /etc/php/$phpVersion/fpm/pool.d/$username.conf /srv/www/$domain/.exp/
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# mysql
|
# mysql
|
||||||
basedatabase=${domain//./dot}
|
basedatabase=${domain//./dot}
|
||||||
|
|
|
@ -45,11 +45,12 @@ if [[ $option = 'virtualhosts' ]]; then
|
||||||
vhost::set-virtualhostArray
|
vhost::set-virtualhostArray
|
||||||
fi
|
fi
|
||||||
|
|
||||||
output="virtualhost username config status"
|
output="virtualhost username config php status"
|
||||||
|
|
||||||
for v in "${virtualhostArray[@]}"
|
for v in "${virtualhostArray[@]}"
|
||||||
do
|
do
|
||||||
owner=$(stat -c '%U' /srv/www/$v)
|
owner=$(stat -c '%U' /srv/www/$v)
|
||||||
|
fpm=$(head -n 1 /etc/apache2/sites-available/$v.conf |grep ^Use|cut -d ' ' -f 5)
|
||||||
if [[ -f /etc/apache2/sites-available/$v.conf ]]; then
|
if [[ -f /etc/apache2/sites-available/$v.conf ]]; then
|
||||||
macro="Custom"
|
macro="Custom"
|
||||||
if head -n 1 /etc/apache2/sites-available/$v.conf |grep --quiet ^Use; then
|
if head -n 1 /etc/apache2/sites-available/$v.conf |grep --quiet ^Use; then
|
||||||
|
@ -65,13 +66,13 @@ if [[ $option = 'virtualhosts' ]]; then
|
||||||
fi
|
fi
|
||||||
if [[ -n $username ]]; then
|
if [[ -n $username ]]; then
|
||||||
if [[ $username = $owner ]]; then
|
if [[ $username = $owner ]]; then
|
||||||
output="$output${NL}$v $owner $macro $status"
|
output="$output${NL}$v $owner $macro $fpm $status"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
output="$output${NL}$v $owner $macro $status"
|
output="$output${NL}$v $owner $macro $fpm $status"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ $output != "virtualhost username config status" ]]; then
|
if [[ $output != "virtualhost username config php status" ]]; then
|
||||||
if [[ $cvs ]]; then
|
if [[ $cvs ]]; then
|
||||||
echo "$output" | tr " " ","
|
echo "$output" | tr " " ","
|
||||||
else
|
else
|
||||||
|
|
|
@ -97,15 +97,16 @@ if [[ $write == 1 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# php-fpm pool
|
# php-fpm pool
|
||||||
vhost::set-phpVersion
|
# vhost::set-phpVersion
|
||||||
if [[ ! -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
vhost::set-phpVersionArray
|
||||||
|
|
||||||
|
for phpVersion in "${phpVersionArray[@]}"
|
||||||
|
do
|
||||||
|
if [[ ! -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
||||||
# create /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
# create /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
echo "[$username]" > /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "[$username]" > /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
echo "user = $username" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "user = $username" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
echo "group = $username" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "group = $username" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
if [ -d /usr/jails/$username ]; then
|
|
||||||
echo "chroot = /usr/jails/$username" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
|
||||||
fi
|
|
||||||
echo "listen = /run/php/php$phpVersion-fpm-$username.sock" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "listen = /run/php/php$phpVersion-fpm-$username.sock" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
echo "listen.owner = www-data" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "listen.owner = www-data" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
echo "listen.group = www-data" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "listen.group = www-data" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
|
@ -116,4 +117,5 @@ if [[ ! -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
||||||
fi
|
fi
|
||||||
echo "pm.max_children = $fpmmax" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "pm.max_children = $fpmmax" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
echo "pm.process_idle_timeout = 3s;" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
echo "pm.process_idle_timeout = 3s;" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
|
@ -56,11 +56,14 @@ fi
|
||||||
|
|
||||||
# checks complete, start removing stuff
|
# checks complete, start removing stuff
|
||||||
|
|
||||||
# check for php-fpm pool conf
|
# check for php-fpm pool confs
|
||||||
vhost::set-phpVersion
|
vhost::set-phpVersionArray
|
||||||
if [[ -f "/etc/php/$phpVersion/fpm/pool.d/$username.conf" ]]; then
|
for phpVersion in "${phpVersionArray[@]}"
|
||||||
|
do
|
||||||
|
if [[ -f "/etc/php/$phpVersion/fpm/pool.d/$username.conf" ]]; then
|
||||||
rm /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
rm /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# if users home dir is mounted in a jail, unmount it
|
# if users home dir is mounted in a jail, unmount it
|
||||||
if grep -q " /usr/jails/$username/home/$username " /etc/mtab; then
|
if grep -q " /usr/jails/$username/home/$username " /etc/mtab; then
|
||||||
|
|
|
@ -20,7 +20,6 @@ help()
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vhost:getoptions "$@"
|
vhost:getoptions "$@"
|
||||||
|
|
||||||
# check for username
|
# check for username
|
||||||
|
@ -57,3 +56,14 @@ install -d -o $username -g $username -m 755 /usr/jails/$username/home/$username
|
||||||
mount --bind /home/$username /usr/jails/$username/home/$username
|
mount --bind /home/$username /usr/jails/$username/home/$username
|
||||||
echo "/home/$username /usr/jails/$username/home/$username none bind 0 0" >> /etc/fstab.jails
|
echo "/home/$username /usr/jails/$username/home/$username none bind 0 0" >> /etc/fstab.jails
|
||||||
jk_jailuser -n -j /usr/jails/$username -s /bin/bash $username
|
jk_jailuser -n -j /usr/jails/$username -s /bin/bash $username
|
||||||
|
|
||||||
|
# configure chroot for php-fpm
|
||||||
|
vhost::set-phpVersionArray
|
||||||
|
for phpVersion in "${phpVersionArray[@]}"
|
||||||
|
do
|
||||||
|
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
||||||
|
if ! /bin/grep -q "^chroot" /etc/php/$phpVersion/fpm/pool.d/$username.conf; then
|
||||||
|
echo "chroot = /usr/jails/$username" >> /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
|
@ -55,13 +55,13 @@ if /bin/grep -q "^$username:" /etc/passwd; then
|
||||||
|
|
||||||
# check for and change php workers
|
# check for and change php workers
|
||||||
if [[ -n "$fpmmax" ]]; then
|
if [[ -n "$fpmmax" ]]; then
|
||||||
vhost::set-phpVersion
|
vhost::set-phpVersionArray
|
||||||
|
for phpVersion in "${phpVersionArray[@]}"
|
||||||
|
do
|
||||||
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
if [[ -f /etc/php/$phpVersion/fpm/pool.d/$username.conf ]]; then
|
||||||
sed -i "s|pm.max_children.*|pm.max_children = $fpmmax|g" /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
sed -i "s|pm.max_children.*|pm.max_children = $fpmmax|g" /etc/php/$phpVersion/fpm/pool.d/$username.conf
|
||||||
else
|
|
||||||
echo "ERROR: PHP config for $username does not exist."
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
16
bin/vhost.sh
16
bin/vhost.sh
|
@ -33,6 +33,12 @@ function vhost::set-phpVersion () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function vhost::set-phpVersionArray () {
|
||||||
|
|
||||||
|
mapfile -t phpVersionArray < <( /usr/bin/update-alternatives --list php-fpm.sock | sed "s|/run/php/php||g" | cut -d \- -f 1 )
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function vhost::set-opensslpass () {
|
function vhost::set-opensslpass () {
|
||||||
|
|
||||||
if [[ -f "/root/.vhost.ini" ]]; then
|
if [[ -f "/root/.vhost.ini" ]]; then
|
||||||
|
@ -57,7 +63,7 @@ function vhost::validate_domain () {
|
||||||
|
|
||||||
function vhost:getoptions () {
|
function vhost:getoptions () {
|
||||||
local OPTIND
|
local OPTIND
|
||||||
while getopts "cd:i:m:o:p:u:j:hnvw:x:" opt ; do
|
while getopts "cd:f:i:m:o:p:u:j:hnvw:x:" opt ; do
|
||||||
case "${opt}" in
|
case "${opt}" in
|
||||||
h ) # display help and exit
|
h ) # display help and exit
|
||||||
help
|
help
|
||||||
|
@ -73,6 +79,14 @@ function vhost:getoptions () {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
f ) # php-fpm version
|
||||||
|
fpm=${OPTARG}
|
||||||
|
vhost::set-phpVersionArray
|
||||||
|
if [[ ! " ${phpVersionArray[@]} " =~ " ${fpm} " ]]; then
|
||||||
|
echo "Invalid PHP-FPM version."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
i ) # User ID (UID) for new user
|
i ) # User ID (UID) for new user
|
||||||
uid=${OPTARG}
|
uid=${OPTARG}
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -26,12 +26,12 @@
|
||||||
#Define ForceHTTPS
|
#Define ForceHTTPS
|
||||||
|
|
||||||
# VHostHTTP - HTTP on Port 80
|
# VHostHTTP - HTTP on Port 80
|
||||||
<Macro VHostHTTP $vhost $username>
|
<Macro VHostHTTP $vhost $username $phpVersion>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html
|
DocumentRoot /srv/www/$vhost/html
|
||||||
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
||||||
|
@ -39,31 +39,31 @@
|
||||||
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
||||||
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</Macro>
|
</Macro>
|
||||||
|
|
||||||
<Macro VHostSubdomainHTTP $vhost $username $subdomain>
|
<Macro VHostSubdomainHTTP $vhost $username $phpVersion $subdomain>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $subdomain.$vhost
|
ServerName $subdomain.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $subdomain.$vhost.${AliasDomain}
|
ServerAlias $subdomain.$vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html/$subdomain
|
DocumentRoot /srv/www/$vhost/html/$subdomain
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</Macro>
|
</Macro>
|
||||||
|
|
||||||
# VHostHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for ${AliasDomain} subdomain
|
# VHostHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for $AliasDomain subdomain
|
||||||
<Macro VHostHTTPS $vhost $username>
|
<Macro VHostHTTPS $vhost $username $phpVersion>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html
|
DocumentRoot /srv/www/$vhost/html
|
||||||
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
||||||
|
@ -78,14 +78,14 @@
|
||||||
</Location>
|
</Location>
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html
|
DocumentRoot /srv/www/$vhost/html
|
||||||
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
||||||
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem
|
SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem
|
||||||
|
@ -113,12 +113,12 @@
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</Macro>
|
</Macro>
|
||||||
|
|
||||||
# VHostSubdomainHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for ${AliasDomain} subdomain
|
# VHostSubdomainHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for $AliasDomain subdomain
|
||||||
<Macro VHostSubdomainHTTPS $vhost $username $subdomain>
|
<Macro VHostSubdomainHTTPS $vhost $username $phpVersion $subdomain>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $subdomain.$vhost
|
ServerName $subdomain.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $subdomain.$vhost.${AliasDomain}
|
ServerAlias $subdomain.$vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html/$subdomain
|
DocumentRoot /srv/www/$vhost/html/$subdomain
|
||||||
<IfDefine ForceHTTPS>
|
<IfDefine ForceHTTPS>
|
||||||
|
@ -129,17 +129,17 @@
|
||||||
</Location>
|
</Location>
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName $subdomain.$vhost
|
ServerName $subdomain.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $subdomain.$vhost.${AliasDomain}
|
ServerAlias $subdomain.$vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html/$subdomain
|
DocumentRoot /srv/www/$vhost/html/$subdomain
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
SSLCertificateFile /etc/ssl/letsencrypt/$subdomain.$vhost.pem
|
SSLCertificateFile /etc/ssl/letsencrypt/$subdomain.$vhost.pem
|
||||||
|
@ -147,12 +147,12 @@
|
||||||
</Macro>
|
</Macro>
|
||||||
|
|
||||||
# VHostHTTPSVarnish - HTTPS on Port 443 proxies to Varnish which then connects to Port 80
|
# VHostHTTPSVarnish - HTTPS on Port 443 proxies to Varnish which then connects to Port 80
|
||||||
<Macro VHostHTTPSVarnish $vhost $username>
|
<Macro VHostHTTPSVarnish $vhost $username $phpVersion>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html
|
DocumentRoot /srv/www/$vhost/html
|
||||||
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
||||||
|
@ -160,14 +160,14 @@
|
||||||
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
||||||
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
RequestHeader set X-Forwarded-Proto https
|
RequestHeader set X-Forwarded-Proto https
|
||||||
ProxyPreserveHost On
|
ProxyPreserveHost On
|
||||||
|
@ -179,21 +179,21 @@
|
||||||
</Macro>
|
</Macro>
|
||||||
|
|
||||||
# VHostSubdomainHTTPSVarnish - HTTPS on Port 443 proxies to Varnish which then connects to Port 80
|
# VHostSubdomainHTTPSVarnish - HTTPS on Port 443 proxies to Varnish which then connects to Port 80
|
||||||
<Macro VHostSubdomainHTTPSVarnish $vhost $username $subdomain>
|
<Macro VHostSubdomainHTTPSVarnish $vhost $username $phpVersion $subdomain>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $subdomain.$vhost
|
ServerName $subdomain.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $subdomain.$vhost.${AliasDomain}
|
ServerAlias $subdomain.$vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html/$subdomain
|
DocumentRoot /srv/www/$vhost/html/$subdomain
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName $subdomain.$vhost
|
ServerName $subdomain.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $subdomain.$vhost.${AliasDomain}
|
ServerAlias $subdomain.$vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
RequestHeader set X-Forwarded-Proto https
|
RequestHeader set X-Forwarded-Proto https
|
||||||
ProxyPreserveHost On
|
ProxyPreserveHost On
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
<Location "/">
|
<Location "/">
|
||||||
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
|
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
<Location "/">
|
<Location "/">
|
||||||
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
|
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
|
||||||
|
@ -274,7 +274,7 @@
|
||||||
ServerName $vhost
|
ServerName $vhost
|
||||||
ServerAlias www.$vhost
|
ServerAlias www.$vhost
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $vhost.${AliasDomain}
|
ServerAlias $vhost.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
<Location "/">
|
<Location "/">
|
||||||
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
|
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
|
||||||
|
@ -286,12 +286,12 @@
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</Macro>
|
</Macro>
|
||||||
|
|
||||||
<Macro VHostAliasHTTP $vhost $username $alias>
|
<Macro VHostAliasHTTP $vhost $username $phpVersion $alias>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $alias
|
ServerName $alias
|
||||||
ServerAlias www.$alias
|
ServerAlias www.$alias
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $alias.${AliasDomain}
|
ServerAlias $alias.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html
|
DocumentRoot /srv/www/$vhost/html
|
||||||
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
||||||
|
@ -299,17 +299,17 @@
|
||||||
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
||||||
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</Macro>
|
</Macro>
|
||||||
|
|
||||||
<Macro VHostAliasHTTPS $vhost $username $alias>
|
<Macro VHostAliasHTTPS $vhost $username $phpVersion $alias>
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName $alias
|
ServerName $alias
|
||||||
ServerAlias www.$alias
|
ServerAlias www.$alias
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $alias.${AliasDomain}
|
ServerAlias $alias.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html
|
DocumentRoot /srv/www/$vhost/html
|
||||||
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
||||||
|
@ -324,14 +324,14 @@
|
||||||
</Location>
|
</Location>
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName $alias
|
ServerName $alias
|
||||||
ServerAlias www.$alias
|
ServerAlias www.$alias
|
||||||
<IfDefine AliasDomain>
|
<IfDefine AliasDomain>
|
||||||
ServerAlias $alias.${AliasDomain}
|
ServerAlias $alias.$AliasDomain
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
DocumentRoot /srv/www/$vhost/html
|
DocumentRoot /srv/www/$vhost/html
|
||||||
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/"
|
||||||
|
@ -339,7 +339,7 @@
|
||||||
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
RewriteCond %{REQUEST_URI} ^/cgi-bin/.*
|
||||||
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
RewriteRule ^/cgi-bin/(.*) /cgi-wrap/cgiwrap/$username/$1 [PT]
|
||||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||||
SetHandler "proxy:unix:/run/php/phpPHPVERSION-fpm-$username.sock|fcgi://localhost"
|
SetHandler "proxy:unix:/run/php/php$phpVersion-fpm-$username.sock|fcgi://localhost"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
SSLCertificateFile /etc/ssl/letsencrypt/$alias.pem
|
SSLCertificateFile /etc/ssl/letsencrypt/$alias.pem
|
||||||
|
|
|
@ -44,9 +44,6 @@ fi
|
||||||
# install systemd files and reload
|
# install systemd files and reload
|
||||||
cp systemd/* /usr/local/lib/systemd/system/
|
cp systemd/* /usr/local/lib/systemd/system/
|
||||||
chmod 644 /usr/local/lib/systemd/system/*
|
chmod 644 /usr/local/lib/systemd/system/*
|
||||||
# set php version
|
|
||||||
sed -i "s|PHPVERSION|$phpVersion|g" /usr/local/lib/systemd/system/vhost-reload-php.path
|
|
||||||
sed -i "s|PHPVERSION|$phpVersion|g" /usr/local/lib/systemd/system/vhost-reload-php.service
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
# install pwgen, used to create random passwords
|
# install pwgen, used to create random passwords
|
||||||
|
@ -161,7 +158,7 @@ fi
|
||||||
|
|
||||||
systemctl reload apache2
|
systemctl reload apache2
|
||||||
systemctl reload php$phpVersion-fpm
|
systemctl reload php$phpVersion-fpm
|
||||||
systemctl enable --now vhost-reload-php.path
|
systemctl enable --now vhost-reload-php@$phpVersion.path
|
||||||
|
|
||||||
# Webalizer
|
# Webalizer
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install webalizer
|
DEBIAN_FRONTEND=noninteractive apt-get -y install webalizer
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
Description="Reload PHP-FPM on changes to pool config files"
|
Description="Reload PHP-FPM on changes to pool config files"
|
||||||
|
|
||||||
[Path]
|
[Path]
|
||||||
PathChanged=/etc/php/PHPVERSION/fpm/pool.d/
|
PathChanged=/etc/php/%i/fpm/pool.d/
|
||||||
Unit=vhost-reload-php.service
|
Unit=vhost-reload-php@%i.service
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=paths.target
|
WantedBy=paths.target
|
|
@ -4,4 +4,4 @@ Description=Reload PHP-FPM
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStartPre=sleep 2
|
ExecStartPre=sleep 2
|
||||||
ExecStart=systemctl try-reload-or-restart phpPHPVERSION-fpm
|
ExecStart=systemctl try-reload-or-restart php%i-fpm
|
Loading…
Reference in New Issue
Block a user