Compare commits
12 Commits
eaaaa72544
...
master
Author | SHA1 | Date | |
---|---|---|---|
5ec756adec | |||
363e1176ff | |||
1488743e63 | |||
068c241353 | |||
5c9eae7f3e | |||
832fe0d2d3 | |||
62575a0908 | |||
0c91a68052 | |||
85c142f978 | |||
80df4e6dfc | |||
98b9cfb4ed | |||
a573c27a46 |
BIN
DOC/504-Gateway-Timeout-Error-AH01075.odt
Normal file
BIN
DOC/504-Gateway-Timeout-Error-AH01075.odt
Normal file
Binary file not shown.
465
add_proxy_parameter_to_vhost_configuration.sh
Executable file
465
add_proxy_parameter_to_vhost_configuration.sh
Executable file
@ -0,0 +1,465 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
script_name="$(basename $(realpath $0))"
|
||||||
|
working_dir="$(dirname $(realpath $0))"
|
||||||
|
|
||||||
|
conf_file="${working_dir}/conf/${script_name%%.*}.conf"
|
||||||
|
|
||||||
|
tmp_log_file="$(mktemp)"
|
||||||
|
|
||||||
|
backup_date="$(date +%Y-%m-%d-%H%M)"
|
||||||
|
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# - Variable settings
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
declare -a vhost_php_fpm_file_arr=()
|
||||||
|
apache_needs_restart=false
|
||||||
|
|
||||||
|
if [[ -f "/usr/local/apache2/conf/httpd.conf" ]]; then
|
||||||
|
_HTTPD_CONF_FILE="/usr/local/apache2/conf/httpd.conf"
|
||||||
|
elif [[ -f "/etc/apache2/apache2.conf" ]]; then
|
||||||
|
_HTTPD_CONF_FILE="/etc/apache2/apache2.conf"
|
||||||
|
else
|
||||||
|
_HTTPD_CONF_FILE=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${_HTTPD_CONF_FILE}" ]] && $(grep -q -i -E "^\s*Timeout\s+" "${_HTTPD_CONF_FILE}") ; then
|
||||||
|
_TIMEOUT="$(grep -i -E "^\s*timeout\s+" "${_HTTPD_CONF_FILE}"| awk '{print$2}' | head -1)"
|
||||||
|
else
|
||||||
|
_TIMEOUT=60
|
||||||
|
fi
|
||||||
|
if [[ -f "${_HTTPD_CONF_FILE}" ]] && $(grep -q -i -E "^\s*ProxyTimeout\s+" "${_HTTPD_CONF_FILE}") ; then
|
||||||
|
PROXY_TIMEOUT="$(grep -i -E "^\s*ProxyTimeout\s+" "${_HTTPD_CONF_FILE}"| awk '{print$2}' | head -1)"
|
||||||
|
else
|
||||||
|
PROXY_TIMEOUT=${_TIMEOUT}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -------------
|
||||||
|
# --- Some functions
|
||||||
|
# -------------
|
||||||
|
|
||||||
|
clean_up() {
|
||||||
|
|
||||||
|
# Perform program exit housekeeping
|
||||||
|
rm -f $tmp_log_file
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
# - Check if a given array (parameter 2) contains a given string (parameter 1)
|
||||||
|
# -
|
||||||
|
containsElement () {
|
||||||
|
local e
|
||||||
|
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
stringContain() {
|
||||||
|
[ -z "${2##*$1*}" ] && [ -z "$1" -o -n "$2" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# - Remove leading/trailling whitespaces
|
||||||
|
# -
|
||||||
|
trim() {
|
||||||
|
local var="$*"
|
||||||
|
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
|
||||||
|
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
|
||||||
|
echo -n "$var"
|
||||||
|
}
|
||||||
|
|
||||||
|
echononl(){
|
||||||
|
echo X\\c > /tmp/shprompt$$
|
||||||
|
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
|
||||||
|
echo -e -n "$*\\c" 1>&2
|
||||||
|
else
|
||||||
|
echo -e -n "$*" 1>&2
|
||||||
|
fi
|
||||||
|
rm /tmp/shprompt$$
|
||||||
|
}
|
||||||
|
|
||||||
|
fatal(){
|
||||||
|
echo ""
|
||||||
|
if [[ -n "$*" ]] ; then
|
||||||
|
echo -e " [ \033[31m\033[1mFatal\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
echo -e " \033[31m\033[1mScript will be interrupted.\033[m\033[m"
|
||||||
|
echo ""
|
||||||
|
clean_up 1
|
||||||
|
}
|
||||||
|
|
||||||
|
error(){
|
||||||
|
echo ""
|
||||||
|
echo -e " [ \033[31m\033[1mFehler\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
warn (){
|
||||||
|
echo ""
|
||||||
|
echo -e " [ \033[33m\033[1mWarning\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
info (){
|
||||||
|
echo ""
|
||||||
|
echo -e " [ \033[32m\033[1mInfo\033[m ]: $*"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_done() {
|
||||||
|
echo -e "\033[80G[ \033[32mdone\033[m ]"
|
||||||
|
}
|
||||||
|
echo_ok() {
|
||||||
|
echo -e "\033[80G[ \033[32mok\033[m ]"
|
||||||
|
}
|
||||||
|
echo_warning() {
|
||||||
|
echo -e "\033[80G[ \033[33m\033[1mwarn\033[m ]"
|
||||||
|
}
|
||||||
|
echo_failed(){
|
||||||
|
echo -e "\033[80G[ \033[1;31mfailed\033[m ]"
|
||||||
|
}
|
||||||
|
echo_skipped() {
|
||||||
|
echo -e "\033[80G[ \033[37mskipped\033[m ]"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap clean_up SIGHUP SIGINT SIGTERM
|
||||||
|
|
||||||
|
|
||||||
|
# - Try to find apache vhost configuration directory
|
||||||
|
# -
|
||||||
|
if [[ -d "/usr/local/apache2/conf/vhosts" ]]; then
|
||||||
|
if [[ -d "/usr/local/apache2/conf/vhosts/0" ]]; then
|
||||||
|
_apache_vhost_dir="/usr/local/apache2/conf/vhosts/0"
|
||||||
|
else
|
||||||
|
_apache_vhost_dir="/usr/local/apache2/conf/vhosts"
|
||||||
|
fi
|
||||||
|
elif [[ -d "/etc/apache2/sites-enabled" ]]; then
|
||||||
|
_apache_vhost_dir="/etc/apache2/sites-enabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo ""
|
||||||
|
echo -e "\033[32mRunning script \033[1m"$(basename $0)"\033[m .."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo -e "\033[32m--\033[m"
|
||||||
|
echo ""
|
||||||
|
echo "Insert Apache VHost directory.."
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
apache_vhost_dir=
|
||||||
|
if [ -z "$_apache_vhost_dir" ]; then
|
||||||
|
echononl "Apache VHost directory: "
|
||||||
|
read apache_vhost_dir
|
||||||
|
while [[ "X$apache_vhost_dir" = "X" ]] ; do
|
||||||
|
echo -e "\n\t\033[33m\033[1mEingabe erforderlich.\033[m\n"
|
||||||
|
echononl "Apache VHost directory: "
|
||||||
|
read apache_vhost_dir
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echononl "Apache VHost directory [${_apache_vhost_dir}]: "
|
||||||
|
read apache_vhost_dir
|
||||||
|
if [[ "X$apache_vhost_dir" = "X" ]] ; then
|
||||||
|
apache_vhost_dir="$_apache_vhost_dir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
index_subdir_apache_vhost_dir="$(expr ${#apache_vhost_dir} + 1)"
|
||||||
|
|
||||||
|
if [[ "$(basename $apache_vhost_dir)" = 'sites-enabled' ]]; then
|
||||||
|
apache_vhost_base_dir="$(dirname $apache_vhost_dir)/sites-available"
|
||||||
|
elif [[ "$(basename $apache_vhost_dir)" =~ vhost ]]; then
|
||||||
|
apache_vhost_base_dir="$apache_vhost_dir"
|
||||||
|
elif [[ "$(basename $(dirname $apache_vhost_dir))" =~ vhost ]]; then
|
||||||
|
apache_vhost_base_dir="$(dirname $apache_vhost_dir)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
declare -i _num=1
|
||||||
|
while IFS='' read -r -d '' fq_name ; do
|
||||||
|
dirname="$(basename "$fq_name")"
|
||||||
|
[[ "$dirname" = "DELETED" ]] && continue
|
||||||
|
[[ "$dirname" = "BAK" ]] && continue
|
||||||
|
[[ "$dirname" = "MAINTENANCE" ]] && continue
|
||||||
|
[[ "$dirname" =~ ^Moved ]] && continue
|
||||||
|
if [[ $_num -eq 1 ]]; then
|
||||||
|
_apache_additional_vhost_dirs="$(basename "$dirname")"
|
||||||
|
else
|
||||||
|
_apache_additional_vhost_dirs="$_apache_additional_vhost_dirs $(basename "$dirname")"
|
||||||
|
fi
|
||||||
|
((_num++))
|
||||||
|
done < <(find $apache_vhost_dir -mindepth 1 -maxdepth 1 -type d -print0)
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo -e "\033[32m--\033[m"
|
||||||
|
echo ""
|
||||||
|
echo "If there are additional apache vhost directories, enter them here .."
|
||||||
|
echo ""
|
||||||
|
echo -e "\033[33m\033[1mNotice\033[m:"
|
||||||
|
echo -e " only first level subdiirectories of \033[1m$apache_vhost_dir\033[m"
|
||||||
|
echo -e " are posible values."
|
||||||
|
echo ""
|
||||||
|
echo "Blank seperated list of directories"
|
||||||
|
echo ""
|
||||||
|
echo -e "Type:"
|
||||||
|
echo -e " \033[33m\033[1mNone\033[m\033[15Gfor no further vhost directoties"
|
||||||
|
echo -e " \033[33m\033[1m<RETURN>\033[m\033[15Gto accept the default inside the square brackets"
|
||||||
|
echo ""
|
||||||
|
apache_additional_vhost_dirs=
|
||||||
|
if [ -z "$_apache_additional_vhost_dirs" ]; then
|
||||||
|
echononl "Additional Apache VHost directory [None]: "
|
||||||
|
read apache_additional_vhost_dirs
|
||||||
|
if [[ -z "trim($apache_additional_vhost_dirs)" ]] ; then
|
||||||
|
apache_additional_vhost_dirs="None"
|
||||||
|
elif [[ "${apache_additional_vhost_dirs,,}" = 'none' ]] ; then
|
||||||
|
apache_additional_vhost_dirs="None"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echononl "Additional Apache VHost directories [${_apache_additional_vhost_dirs}]: "
|
||||||
|
read apache_additional_vhost_dirs
|
||||||
|
if [[ "${apache_additional_vhost_dirs,,}" = 'none' ]] ; then
|
||||||
|
apache_additional_vhost_dirs="None"
|
||||||
|
elif [[ -z "$(trim $apache_additional_vhost_dirs)" ]] ; then
|
||||||
|
apache_additional_vhost_dirs="$_apache_additional_vhost_dirs"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$apache_additional_vhost_dirs" ]] && [[ "$apache_additional_vhost_dirs" != "None" ]]; then
|
||||||
|
declare -a apache_additional_vhost_dir_arr=()
|
||||||
|
for _dir in $apache_additional_vhost_dirs ; do
|
||||||
|
if [[ -d "${apache_vhost_dir}/$_dir" ]] ; then
|
||||||
|
apache_additional_vhost_dir_arr+=("$_dir")
|
||||||
|
else
|
||||||
|
warn "$_dir is not a subdirectory of ${apache_vhost_dir}.\n\n \033[33m\033[1mIgnoring directory $_dir\033[m.."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "apache_additional_vhost_dirs: $apache_additional_vhost_dirs"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e " Apache Vhosts Directory................: \033[1m$apache_vhost_dir\033[m"
|
||||||
|
if [[ ${#apache_additional_vhost_dir_arr[@]} -gt 0 ]] ; then
|
||||||
|
declare -i counter=1
|
||||||
|
echo -en " Additional VHost Directories...........:\033[1m"
|
||||||
|
for _dir in ${apache_additional_vhost_dir_arr[@]} ; do
|
||||||
|
if [[ $counter -eq 1 ]] ; then
|
||||||
|
echo -e " \033[1m$_dir\033[m"
|
||||||
|
else
|
||||||
|
echo -e " \033[1m$_dir\033[m"
|
||||||
|
fi
|
||||||
|
counter=$((counter+1))
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo -e -n "\033[1mContinue with above settings? [y/n]:\033[m "
|
||||||
|
read OK
|
||||||
|
while [[ "X${OK}X" = "XX" ]] ; do
|
||||||
|
echo ""
|
||||||
|
echo -e -n "\033[1mContinue with above settings? [y/n]:\033[m "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${OK,,}" != 'yes' ]] && [[ "${OK,,}" != 'y' ]]; then
|
||||||
|
fatal "Abort by user request."
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echononl " Backup existing VHost Configuration directory"
|
||||||
|
if [[ -d "$apache_vhost_base_dir" ]]; then
|
||||||
|
|
||||||
|
cp -a "$apache_vhost_base_dir" "${apache_vhost_base_dir}.$backup_date" > $tmp_log_file 2>&1
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $tmp_log_file)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echononl " Create vhost file array.."
|
||||||
|
for _pgp_fpm_file in $(ls ${apache_vhost_dir}/*.php-fpm) ; do
|
||||||
|
vhost_php_fpm_file_arr+=("${_pgp_fpm_file}")
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ${#apache_additional_vhost_dir_arr[@]} -gt 0 ]] ; then
|
||||||
|
for _dir in ${apache_additional_vhost_dir_arr[@]} ; do
|
||||||
|
for _pgp_fpm_file in $(ls ${apache_vhost_dir}/${_dir}/*.php-fpm) ; do
|
||||||
|
vhost_php_fpm_file_arr+=("${_pgp_fpm_file}")
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${#vhost_php_fpm_file_arr[@]} -gt 0 ]] ; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
warn "No vhost configuration file found!"
|
||||||
|
clean_up 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
_found_unchanged_part_follows_pipe=false
|
||||||
|
echononl " Replace SetHandler part that follows the pipe.."
|
||||||
|
for vhost_php_fpm_file in ${vhost_php_fpm_file_arr[@]} ; do
|
||||||
|
$(grep -q -E "^\s*SetHandler\s+.*fcgi://php/" "${vhost_php_fpm_file}" 2> /dev/null) && continue
|
||||||
|
_found_unchanged_part_follows_pipe=true
|
||||||
|
apache_needs_restart=true
|
||||||
|
perl -i -n -p -e "s#fcgi://127.0.0.1#fcgi://php/#" ${vhost_php_fpm_file}
|
||||||
|
done
|
||||||
|
if $_found_unchanged_part_follows_pipe ; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_skipped
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
regex_file_match_end="[[:space:]]*</FilesMatch>"
|
||||||
|
|
||||||
|
if [[ ${#vhost_php_fpm_file_arr[@]} -gt 0 ]] ; then
|
||||||
|
for vhost_php_fpm_file in ${vhost_php_fpm_file_arr[@]} ; do
|
||||||
|
|
||||||
|
echononl " Change vhost file \033[1m${vhost_php_fpm_file}\033[m"
|
||||||
|
|
||||||
|
if $(grep -q -E "^\s*<Proxy\s+\"fcgi://php/\">" "${vhost_php_fpm_file}" 2> /dev/null) ; then
|
||||||
|
echo_skipped
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
apache_needs_restart=true
|
||||||
|
|
||||||
|
mv "${vhost_php_fpm_file}" "/tmp"
|
||||||
|
|
||||||
|
> "${vhost_php_fpm_file}"
|
||||||
|
|
||||||
|
|
||||||
|
_found=false
|
||||||
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
|
|
||||||
|
echo "${line}" >> "${vhost_php_fpm_file}"
|
||||||
|
|
||||||
|
if ! $_found && [[ $line =~ $regex_file_match_end ]] ; then
|
||||||
|
cat <<EOF >> "${vhost_php_fpm_file}"
|
||||||
|
|
||||||
|
# Define a matching worker.
|
||||||
|
# The part that is matched to the SetHandler is the part that
|
||||||
|
# follows the pipe. If you need to distinguish, "localhost; can
|
||||||
|
# be anything unique.
|
||||||
|
#
|
||||||
|
<Proxy "fcgi://php/">
|
||||||
|
|
||||||
|
# Recycle connections to the fastcgi dispatcher (PHP FPM).
|
||||||
|
#
|
||||||
|
# Use persistent connections to reduce the constant overhead of setting
|
||||||
|
# up new connections
|
||||||
|
#
|
||||||
|
ProxySet enablereuse=on
|
||||||
|
|
||||||
|
# max - the most proxied request per server
|
||||||
|
#
|
||||||
|
# max = pm.max_children / max number of servers
|
||||||
|
# = pm.max_children / (MaxRequestWorkers / ThreadsPerChild)
|
||||||
|
#
|
||||||
|
ProxySet max=16
|
||||||
|
|
||||||
|
# Forces the module to flush every chunk of data received from the FCGI backend
|
||||||
|
# as soon as it receives it, without buffering.
|
||||||
|
#
|
||||||
|
ProxySet flushpackets=on
|
||||||
|
|
||||||
|
# connectiontimeout
|
||||||
|
#
|
||||||
|
# Connect timeout in seconds. The number of seconds Apache httpd waits for the
|
||||||
|
# creation of a connection to the backend to complete. By adding a postfix of ms,
|
||||||
|
# the timeout can be also set in milliseconds.
|
||||||
|
#
|
||||||
|
ProxySet connectiontimeout=5
|
||||||
|
|
||||||
|
# timeout
|
||||||
|
#
|
||||||
|
# Socket timeout in seconds. The number of seconds Apache httpd waits for data
|
||||||
|
# sent by / to the backend.
|
||||||
|
#
|
||||||
|
#ProxySet timeout=${PROXY_TIMEOUT}
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
</Proxy>
|
||||||
|
EOF
|
||||||
|
_found=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
done <"/tmp/$(basename "${vhost_php_fpm_file}")"
|
||||||
|
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $tmp_log_file)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $apache_needs_restart ; then
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo -e "\033[32m------\033[m"
|
||||||
|
echo -e "Restart Apache Webservice"
|
||||||
|
echo -e "\033[32m------\033[m"
|
||||||
|
|
||||||
|
OK=""
|
||||||
|
echo ""
|
||||||
|
echo "Type 'y' to continue 'n' or any other key to skip removal of Domains"
|
||||||
|
echo
|
||||||
|
echo -e -n "\033[1mRestart Apache Webservice [y/n]:\033[m "
|
||||||
|
read OK
|
||||||
|
while [[ "X${OK}X" = "XX" ]] ; do
|
||||||
|
echo ""
|
||||||
|
echo -e -n "\033[1mRestart Apache Webservice [y/n]:\033[m "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${OK,,}" = 'yes' ]] || [[ "${OK,,}" = 'y' ]]; then
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echononl " Graceful restart Apache Webservice.."
|
||||||
|
apachectl graceful
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
error "$(cat $tmp_log_file)"
|
||||||
|
echo "Error: $(cat $tmp_log_file)" >> $main_log
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi # if [[ "${OK,,}" = 'yes' ]] || [[ "${OK,,}" = 'y' ]]; then
|
||||||
|
|
||||||
|
fi # if $apache_needs_restart
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
clean_up 0
|
@ -2,16 +2,34 @@
|
|||||||
## - Configuration File for Script "create_summary_websites.sh"
|
## - Configuration File for Script "create_summary_websites.sh"
|
||||||
## ===================================================================
|
## ===================================================================
|
||||||
|
|
||||||
# - DST_PATH_PHP
|
# - WEB_DOCROOT
|
||||||
|
# -
|
||||||
|
# - Websites DocumentRoot
|
||||||
|
# -
|
||||||
|
# - DocumentRoot of the website, which holds the statistioc files.
|
||||||
|
# -
|
||||||
|
#WEB_DOCROOT="/var/www/web-01.oopen.de/htdocs"
|
||||||
|
|
||||||
|
# - DST_PATH_STATS
|
||||||
# -
|
# -
|
||||||
# - Destination Path for statistics
|
# - Destination Path for statistics
|
||||||
# -
|
# -
|
||||||
DST_PATH_PHP="/var/www/html/dummy/htdocs/website-stats"
|
# - Defaults to: ${WEB_DOCROOT}/website-stats
|
||||||
|
#
|
||||||
|
#DST_PATH_STATS="${WEB_DOCROOT}/website-stats"
|
||||||
|
|
||||||
# - DST_DIR_CSV
|
# - DST_DIR_CSV
|
||||||
# -
|
# -
|
||||||
# - Destination Path for generated csv-files
|
# - Destination Path for generated csv-files
|
||||||
# -
|
# -
|
||||||
# - Defaults to: ${DST_PATH_PHP}/csv-files-website-stats
|
# - Defaults to: ${DST_PATH_STATS}/csv-files-website-stats
|
||||||
# -
|
# -
|
||||||
DST_DIR_CSV="${DST_PATH_PHP}/csv-files-website-stats"
|
#DST_DIR_CSV="${DST_PATH_STATS}/csv-files-website-stats"
|
||||||
|
|
||||||
|
# - WEB_DIR_CSV
|
||||||
|
# -
|
||||||
|
# - Destination Path for generated csv-files
|
||||||
|
# -
|
||||||
|
# - Defaults to: /website-stats/csv-files-website-stats
|
||||||
|
# -
|
||||||
|
#WEB_DIR_CSV="/website-stats/csv-files-website-stats"
|
||||||
|
@ -110,10 +110,11 @@ DNS_MASTER_SERVER=""
|
|||||||
# - $ mysql --login-path=local ...
|
# - $ mysql --login-path=local ...
|
||||||
# -
|
# -
|
||||||
# - Example
|
# - Example
|
||||||
# - mysql_credential_args="--login-path=local"
|
# - MYSQL_CREDENTIAL_ARGS="--login-path=local"
|
||||||
# - mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf" (Debian default)
|
# - MYSQL_CREDENTIAL_ARGS="--defaults-file=/etc/mysql/debian.cnf" (Debian default)
|
||||||
# - mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
|
# - MYSQL_CREDENTIAL_ARGS="--defaults-file=/usr/local/mysql/sys-maint.cnf"
|
||||||
|
# - MYSQL_CREDENTIAL_ARGS="-u root -S /run/mysqld/mysqld.sock"
|
||||||
# -
|
# -
|
||||||
# - Defaults to '--login-path=local'
|
# - Defaults to '-u root -S /run/mysqld/mysqld.sock'
|
||||||
# -
|
# -
|
||||||
#MYSQL_CREDENTIAL_ARGS="--login-path=local"
|
#MYSQL_CREDENTIAL_ARGS="-u root -S /run/mysqld/mysqld.sock"
|
||||||
|
@ -12,7 +12,7 @@ declare -a apache_vhost_dir_arr
|
|||||||
declare -a _all_vhost_files_arr
|
declare -a _all_vhost_files_arr
|
||||||
declare -a _all_document_root_dirs_arr
|
declare -a _all_document_root_dirs_arr
|
||||||
|
|
||||||
PHP_VERIONS_SUPPORTED="5.3 5.4 5.5 5.6 7.0.7.1 7.2 7.3 7.4 8.0 8.1"
|
PHP_VERIONS_SUPPORTED="5.3 5.4 5.5 5.6 7.0.7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3"
|
||||||
|
|
||||||
declare -i number_websites_53=0
|
declare -i number_websites_53=0
|
||||||
declare -i number_websites_54=0
|
declare -i number_websites_54=0
|
||||||
@ -25,6 +25,8 @@ declare -i number_websites_73=0
|
|||||||
declare -i number_websites_74=0
|
declare -i number_websites_74=0
|
||||||
declare -i number_websites_80=0
|
declare -i number_websites_80=0
|
||||||
declare -i number_websites_81=0
|
declare -i number_websites_81=0
|
||||||
|
declare -i number_websites_82=0
|
||||||
|
declare -i number_websites_83=0
|
||||||
declare -i number_redirected=0
|
declare -i number_redirected=0
|
||||||
declare -i number_parked=0
|
declare -i number_parked=0
|
||||||
declare -i number_mod_php=0
|
declare -i number_mod_php=0
|
||||||
@ -59,6 +61,8 @@ clean_up() {
|
|||||||
rm -f $_tmp_filename_php_74
|
rm -f $_tmp_filename_php_74
|
||||||
rm -f $_tmp_filename_php_80
|
rm -f $_tmp_filename_php_80
|
||||||
rm -f $_tmp_filename_php_81
|
rm -f $_tmp_filename_php_81
|
||||||
|
rm -f $_tmp_filename_php_82
|
||||||
|
rm -f $_tmp_filename_php_83
|
||||||
rm -f $_tmp_filename_not_considered
|
rm -f $_tmp_filename_not_considered
|
||||||
rm -f $_tmp_filename_no_php_assigned
|
rm -f $_tmp_filename_no_php_assigned
|
||||||
exit $1
|
exit $1
|
||||||
@ -110,29 +114,27 @@ if [[ -f "$conf_file" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ -z "$DST_PATH_PHP" ]]; then
|
if [[ -z "$WEB_DOCROOT" ]]; then
|
||||||
if [[ -d "/var/www/html/dummy/htdocs" ]] ; then
|
fatal "Missing value for variable 'WEB_DOCROOT'!"
|
||||||
DST_PATH_PHP="/var/www/html/dummy/htdocs"
|
|
||||||
elif [[ -d "/var/www/html/dummy" ]] ; then
|
|
||||||
DST_PATH_PHP="/var/www/html/dummy"
|
|
||||||
elif [[ -d "/var/www/default" ]] ; then
|
|
||||||
DST_PATH_PHP="$DST_PATH_PHP"
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
if [[ ! -d "$DST_PATH_PHP" ]]; then
|
if [[ -z "$DST_PATH_STATS" ]]; then
|
||||||
mkdir "$DST_PATH_PHP" > /dev/null 2>&1
|
DST_PATH_STATS="${WEB_DOCROOT}/website-stats"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d "$DST_PATH_STATS" ]]; then
|
||||||
|
mkdir "$DST_PATH_STATS" > /dev/null 2>&1
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
fatal "Creation of directory '$DST_PATH_PHP' failed!"
|
fatal "Creation of directory '$DST_PATH_STATS' failed!"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$DST_PATH_PHP" ]]; then
|
if [[ -z "$DST_PATH_STATS" ]]; then
|
||||||
fatal "Destination Path for statistics (parameter 'DST_PATH_PHP') not found!"
|
fatal "Destination Path for statistics (parameter 'DST_PATH_STATS') not found!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$DST_DIR_CSV" ]] ; then
|
if [[ -z "$DST_DIR_CSV" ]] ; then
|
||||||
DST_DIR_CSV="${DST_PATH_PHP}/csv-files-website-stats"
|
DST_DIR_CSV="${DST_PATH_STATS}/csv-files-website-stats"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d "$DST_DIR_CSV" ]]; then
|
if [[ ! -d "$DST_DIR_CSV" ]]; then
|
||||||
@ -142,9 +144,13 @@ if [[ ! -d "$DST_DIR_CSV" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${WEB_DIR_CSV}" ]]; then
|
||||||
|
WEB_DIR_CSV="/website-stats/csv-files-website-stats"
|
||||||
|
fi
|
||||||
|
|
||||||
_tmp_filename_summary=$(mktemp)
|
_tmp_filename_summary=$(mktemp)
|
||||||
filename_summary="${DST_DIR_CSV}/WEBSITES_SUMMARY.csv"
|
filename_summary="${DST_DIR_CSV}/WEBSITES_SUMMARY.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_summary.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_summary.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_summary)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_summary)\"");
|
||||||
@ -158,7 +164,7 @@ echo ";" >> $filename_summary
|
|||||||
|
|
||||||
_tmp_filename_redirected=$(mktemp)
|
_tmp_filename_redirected=$(mktemp)
|
||||||
filename_redirected="${DST_DIR_CSV}/WEBSITES_REDIRECTED.csv"
|
filename_redirected="${DST_DIR_CSV}/WEBSITES_REDIRECTED.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_redirected.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_redirected.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_redirected)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_redirected)\"");
|
||||||
@ -172,7 +178,7 @@ echo ";" >> $filename_redirected
|
|||||||
|
|
||||||
_tmp_filename_parked=$(mktemp)
|
_tmp_filename_parked=$(mktemp)
|
||||||
filename_parked="${DST_DIR_CSV}/WEBSITES_PARKED.csv"
|
filename_parked="${DST_DIR_CSV}/WEBSITES_PARKED.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_parked.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_parked.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_parked)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_parked)\"");
|
||||||
@ -186,7 +192,7 @@ echo ";" >> $filename_parked
|
|||||||
|
|
||||||
_tmp_filename_mod_php=$(mktemp)
|
_tmp_filename_mod_php=$(mktemp)
|
||||||
filename_mod_php="${DST_DIR_CSV}/WEBSITES_MOD_PHP.csv"
|
filename_mod_php="${DST_DIR_CSV}/WEBSITES_MOD_PHP.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_mod_php.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_mod_php.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_mod_php)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_mod_php)\"");
|
||||||
@ -200,7 +206,7 @@ echo ";" >> $filename_mod_php
|
|||||||
|
|
||||||
_tmp_filename_php_fpm=$(mktemp)
|
_tmp_filename_php_fpm=$(mktemp)
|
||||||
filename_php_fpm="${DST_DIR_CSV}/WEBSITES_PHP_FPM.csv"
|
filename_php_fpm="${DST_DIR_CSV}/WEBSITES_PHP_FPM.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_fpm.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_fpm.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_fpm)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_fpm)\"");
|
||||||
@ -214,7 +220,7 @@ echo ";" >> $filename_php_fpm
|
|||||||
|
|
||||||
_tmp_filename_php_fcgid=$(mktemp)
|
_tmp_filename_php_fcgid=$(mktemp)
|
||||||
filename_php_fcgid="${DST_DIR_CSV}/WEBSITES_PHP_FCGID.csv"
|
filename_php_fcgid="${DST_DIR_CSV}/WEBSITES_PHP_FCGID.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_fcgid.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_fcgid.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_fcgid)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_fcgid)\"");
|
||||||
@ -228,7 +234,7 @@ echo ";" >> $filename_php_fcgid
|
|||||||
|
|
||||||
_tmp_filename_php_53=$(mktemp)
|
_tmp_filename_php_53=$(mktemp)
|
||||||
filename_php_53="${DST_DIR_CSV}/WEBSITES_PHP_53.csv"
|
filename_php_53="${DST_DIR_CSV}/WEBSITES_PHP_53.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_53.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_53.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_53)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_53)\"");
|
||||||
@ -242,7 +248,7 @@ echo ";" >> $filename_php_53
|
|||||||
|
|
||||||
_tmp_filename_php_54=$(mktemp)
|
_tmp_filename_php_54=$(mktemp)
|
||||||
filename_php_54="${DST_DIR_CSV}/WEBSITES_PHP_54.csv"
|
filename_php_54="${DST_DIR_CSV}/WEBSITES_PHP_54.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_54.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_54.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_54)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_54)\"");
|
||||||
@ -256,7 +262,7 @@ echo ";" >> $filename_php_54
|
|||||||
|
|
||||||
_tmp_filename_php_55=$(mktemp)
|
_tmp_filename_php_55=$(mktemp)
|
||||||
filename_php_55="${DST_DIR_CSV}/WEBSITES_PHP_55.csv"
|
filename_php_55="${DST_DIR_CSV}/WEBSITES_PHP_55.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_55.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_55.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_55)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_55)\"");
|
||||||
@ -270,7 +276,7 @@ echo ";" >> $filename_php_55
|
|||||||
|
|
||||||
_tmp_filename_php_56=$(mktemp)
|
_tmp_filename_php_56=$(mktemp)
|
||||||
filename_php_56="${DST_DIR_CSV}/WEBSITES_PHP_56.csv"
|
filename_php_56="${DST_DIR_CSV}/WEBSITES_PHP_56.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_56.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_56.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_56)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_56)\"");
|
||||||
@ -284,7 +290,7 @@ echo ";" >> $filename_php_56
|
|||||||
|
|
||||||
_tmp_filename_php_70=$(mktemp)
|
_tmp_filename_php_70=$(mktemp)
|
||||||
filename_php_70="${DST_DIR_CSV}/WEBSITES_PHP_70.csv"
|
filename_php_70="${DST_DIR_CSV}/WEBSITES_PHP_70.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_70.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_70.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_70)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_70)\"");
|
||||||
@ -298,7 +304,7 @@ echo ";" >> $filename_php_70
|
|||||||
|
|
||||||
_tmp_filename_php_71=$(mktemp)
|
_tmp_filename_php_71=$(mktemp)
|
||||||
filename_php_71="${DST_DIR_CSV}/WEBSITES_PHP_71.csv"
|
filename_php_71="${DST_DIR_CSV}/WEBSITES_PHP_71.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_71.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_71.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_71)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_71)\"");
|
||||||
@ -312,7 +318,7 @@ echo ";" >> $filename_php_71
|
|||||||
|
|
||||||
_tmp_filename_php_72=$(mktemp)
|
_tmp_filename_php_72=$(mktemp)
|
||||||
filename_php_72="${DST_DIR_CSV}/WEBSITES_PHP_72.csv"
|
filename_php_72="${DST_DIR_CSV}/WEBSITES_PHP_72.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_72.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_72.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_72)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_72)\"");
|
||||||
@ -326,7 +332,7 @@ echo ";" >> $filename_php_72
|
|||||||
|
|
||||||
_tmp_filename_php_73=$(mktemp)
|
_tmp_filename_php_73=$(mktemp)
|
||||||
filename_php_73="${DST_DIR_CSV}/WEBSITES_PHP_73.csv"
|
filename_php_73="${DST_DIR_CSV}/WEBSITES_PHP_73.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_73.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_73.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_73)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_73)\"");
|
||||||
@ -340,7 +346,7 @@ echo ";" >> $filename_php_73
|
|||||||
|
|
||||||
_tmp_filename_php_74=$(mktemp)
|
_tmp_filename_php_74=$(mktemp)
|
||||||
filename_php_74="${DST_DIR_CSV}/WEBSITES_PHP_74.csv"
|
filename_php_74="${DST_DIR_CSV}/WEBSITES_PHP_74.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_74.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_74.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_74)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_74)\"");
|
||||||
@ -354,7 +360,7 @@ echo ";" >> $filename_php_74
|
|||||||
|
|
||||||
_tmp_filename_php_80=$(mktemp)
|
_tmp_filename_php_80=$(mktemp)
|
||||||
filename_php_80="${DST_DIR_CSV}/WEBSITES_PHP_80.csv"
|
filename_php_80="${DST_DIR_CSV}/WEBSITES_PHP_80.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_80.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_80.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_80)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_80)\"");
|
||||||
@ -368,7 +374,7 @@ echo ";" >> $filename_php_80
|
|||||||
|
|
||||||
_tmp_filename_php_81=$(mktemp)
|
_tmp_filename_php_81=$(mktemp)
|
||||||
filename_php_81="${DST_DIR_CSV}/WEBSITES_PHP_81.csv"
|
filename_php_81="${DST_DIR_CSV}/WEBSITES_PHP_81.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_php_81.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_81.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_81)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_81)\"");
|
||||||
@ -380,10 +386,38 @@ EOF
|
|||||||
echo "Website; ;PHP Version; ;PHP Engine; ;Database; ;CMS; ;DocumentRoot; ;VHost file; ;Server Alias(es)" > $filename_php_81
|
echo "Website; ;PHP Version; ;PHP Engine; ;Database; ;CMS; ;DocumentRoot; ;VHost file; ;Server Alias(es)" > $filename_php_81
|
||||||
echo ";" >> $filename_php_81
|
echo ";" >> $filename_php_81
|
||||||
|
|
||||||
|
_tmp_filename_php_82=$(mktemp)
|
||||||
|
filename_php_82="${DST_DIR_CSV}/WEBSITES_PHP_82.csv"
|
||||||
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_82.php
|
||||||
|
<?php
|
||||||
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_82)\"");
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
header('Expires: 0');
|
||||||
|
readfile("$filename_php_82");
|
||||||
|
?>
|
||||||
|
EOF
|
||||||
|
echo "Website; ;PHP Version; ;PHP Engine; ;Database; ;CMS; ;DocumentRoot; ;VHost file; ;Server Alias(es)" > $filename_php_82
|
||||||
|
echo ";" >> $filename_php_82
|
||||||
|
|
||||||
|
_tmp_filename_php_83=$(mktemp)
|
||||||
|
filename_php_83="${DST_DIR_CSV}/WEBSITES_PHP_83.csv"
|
||||||
|
cat <<EOF > ${DST_PATH_STATS}/websites_php_83.php
|
||||||
|
<?php
|
||||||
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_php_83)\"");
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
header('Expires: 0');
|
||||||
|
readfile("$filename_php_83");
|
||||||
|
?>
|
||||||
|
EOF
|
||||||
|
echo "Website; ;PHP Version; ;PHP Engine; ;Database; ;CMS; ;DocumentRoot; ;VHost file; ;Server Alias(es)" > $filename_php_83
|
||||||
|
echo ";" >> $filename_php_83
|
||||||
|
|
||||||
|
|
||||||
_tmp_filename_not_considered=$(mktemp)
|
_tmp_filename_not_considered=$(mktemp)
|
||||||
filename_not_considered="${DST_DIR_CSV}/VHOST_FILES_NOT_CONSIDERED.csv"
|
filename_not_considered="${DST_DIR_CSV}/VHOST_FILES_NOT_CONSIDERED.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/vhost_files_not_considered.php
|
cat <<EOF > ${DST_PATH_STATS}/vhost_files_not_considered.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_not_considered)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_not_considered)\"");
|
||||||
@ -398,7 +432,7 @@ echo ";" >> $filename_not_considered
|
|||||||
|
|
||||||
_tmp_filename_no_php_assigned=$(mktemp)
|
_tmp_filename_no_php_assigned=$(mktemp)
|
||||||
filename_no_php_assigned="${DST_DIR_CSV}/WEBSITES_NO_PHP_FOUND.csv"
|
filename_no_php_assigned="${DST_DIR_CSV}/WEBSITES_NO_PHP_FOUND.csv"
|
||||||
cat <<EOF > ${DST_PATH_PHP}/websites_no_php_found.php
|
cat <<EOF > ${DST_PATH_STATS}/websites_no_php_found.php
|
||||||
<?php
|
<?php
|
||||||
header('Content-Type:application/csv ; charset=utf-8');
|
header('Content-Type:application/csv ; charset=utf-8');
|
||||||
header("Content-Disposition: attachment; filename=\"$(basename $filename_no_php_assigned)\"");
|
header("Content-Disposition: attachment; filename=\"$(basename $filename_no_php_assigned)\"");
|
||||||
@ -1059,6 +1093,20 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$_php_version" =~ ^8.2 ]]; then
|
||||||
|
echo "$_server_name;;$_php_version;;$_php_engine;;$database;;$site_cms;;$_documentroot;;$_vhost_file;;$server_aliases" >> $_tmp_filename_php_82
|
||||||
|
|
||||||
|
((number_websites_82++))
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$_php_version" =~ ^8.3 ]]; then
|
||||||
|
echo "$_server_name;;$_php_version;;$_php_engine;;$database;;$site_cms;;$_documentroot;;$_vhost_file;;$server_aliases" >> $_tmp_filename_php_83
|
||||||
|
|
||||||
|
((number_websites_83++))
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
elif ! $_vhost_file_not_considered ; then
|
elif ! $_vhost_file_not_considered ; then
|
||||||
_redirect_site=""
|
_redirect_site=""
|
||||||
_redirect_site=$(grep -E "^\s*RewriteRule" $_vhost_file 2> /dev/null | awk '{print$3}' | sed 's/"//g' | sed 's/\/$//' | sed 's/https\?:\/\///g' | sed 's/\$1//g' | sort -u)
|
_redirect_site=$(grep -E "^\s*RewriteRule" $_vhost_file 2> /dev/null | awk '{print$3}' | sed 's/"//g' | sed 's/\/$//' | sed 's/https\?:\/\///g' | sed 's/\$1//g' | sort -u)
|
||||||
@ -1099,6 +1147,7 @@ cat $_tmp_filename_php_73 | sort >> $filename_php_73
|
|||||||
cat $_tmp_filename_php_74 | sort >> $filename_php_74
|
cat $_tmp_filename_php_74 | sort >> $filename_php_74
|
||||||
cat $_tmp_filename_php_80 | sort >> $filename_php_80
|
cat $_tmp_filename_php_80 | sort >> $filename_php_80
|
||||||
cat $_tmp_filename_php_81 | sort >> $filename_php_81
|
cat $_tmp_filename_php_81 | sort >> $filename_php_81
|
||||||
|
cat $_tmp_filename_php_82 | sort >> $filename_php_82
|
||||||
cat $_tmp_filename_not_considered | sort >> $filename_not_considered
|
cat $_tmp_filename_not_considered | sort >> $filename_not_considered
|
||||||
cat $_tmp_filename_no_php_assigned | sort >> $filename_no_php_assigned
|
cat $_tmp_filename_no_php_assigned | sort >> $filename_no_php_assigned
|
||||||
|
|
||||||
@ -1107,89 +1156,170 @@ cat $_tmp_filename_no_php_assigned | sort >> $filename_no_php_assigned
|
|||||||
# - Create summary file index.php
|
# - Create summary file index.php
|
||||||
# -----
|
# -----
|
||||||
|
|
||||||
cat <<EOF > ${DST_PATH_PHP}/index.php
|
if [[ -f "${DST_PATH_STATS}/index.php" ]]; then
|
||||||
|
rm "${DST_PATH_STATS}/index.php"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF > ${DST_PATH_STATS}/index.html
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Statistics websites $(hostname -f)</title>
|
<title>Statistics websites $(hostname -f)</title>
|
||||||
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
||||||
|
<meta http-equiv="Pragma" content="no-cache">
|
||||||
|
<meta http-equiv="Expires" content="0">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h4>$(hostname -f)</h4>
|
<h4>$(hostname -f)</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="websites_summary.php">full summary of all hosted websites</a>: $number_overall</li>
|
EOF
|
||||||
|
if [[ $number_overall -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_summary)">full summary of all hosted websites</a>: $number_overall</li>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li>full summary of all hosted websites: $number_overall</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<br />
|
<br />
|
||||||
<li><a href="websites_redirected.php">redirected websites</a>: $number_redirected</li>
|
EOF
|
||||||
<li><a href="websites_parked.php">parked websites</a>: $number_parked</li>
|
if [[ $number_redirected -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_redirected)">redirected websites</a>: $number_redirected</li>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li>redirected websites: $number_redirected</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [[ $number_parked -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_parked)">parked websites</a>: $number_parked</li>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li>parked websites: $number_parked</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<br />
|
<br />
|
||||||
<li><a href="websites_mod_php.php">websites mod_php</a>: $number_mod_php</li>
|
EOF
|
||||||
<li><a href="websites_php_fpm.php">websites PHP-FPM</a>: $number_php_fpm</li>
|
if [[ $number_mod_php -gt 0 ]]; then
|
||||||
<li><a href="websites_php_fcgid.php">websites FastCGI</a>: $number_php_fcgid</li>
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_mod_php)">websites mod_php</a>: $number_mod_php</li>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li>websites mod_php: $number_mod_php</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [[ $number_php_fpm -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_fpm)">websites PHP-FPM</a>: $number_php_fpm</li>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li>websites PHP-FPM: $number_php_fpm</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [[ $number_php_fcgid -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_fcgid)">websites FastCGI</a>: $number_php_fcgid</li>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li>websites FastCGI: $number_php_fcgid</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<br />
|
<br />
|
||||||
<li><a href="websites_no_php_found.php">websites no PHP assigned</a>: $number_no_php_assigned</li>
|
EOF
|
||||||
|
if [[ $number_no_php_assigned -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_no_php_assigned)">websites no PHP assigned</a>: $number_no_php_assigned</li>
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li>websites no PHP assigned: $number_no_php_assigned</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
</ul>
|
</ul>
|
||||||
<hr width="100" align="left">
|
<hr width="100" align="left">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="vhost_files_not_considered.php">vhost_files not considered</a>: $number_not_considered</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_not_considered)">vhost_files not considered</a>: $number_not_considered</li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr width="100" align="left">
|
<hr width="100" align="left">
|
||||||
<h5>PHP versions supported by this script:<br /> $PHP_VERIONS_SUPPORTED</h5>
|
<h5>PHP versions supported by this script:<br /> $PHP_VERIONS_SUPPORTED</h5>
|
||||||
<ul>
|
<ul>
|
||||||
EOF
|
EOF
|
||||||
if [[ $number_websites_53 -gt 0 ]]; then
|
if [[ $number_websites_53 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_53.php">websites PHP v5.3</a>: $number_websites_53</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_74)">websites PHP v5.3</a>: $number_websites_53</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_54 -gt 0 ]]; then
|
if [[ $number_websites_54 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_54.php">websites PHP v5.4</a>: $number_websites_54</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_54)">websites PHP v5.4</a>: $number_websites_54</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_55 -gt 0 ]]; then
|
if [[ $number_websites_55 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_55.php">websites PHP v5.5</a>: $number_websites_55</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_55)">websites PHP v5.5</a>: $number_websites_55</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_56 -gt 0 ]]; then
|
if [[ $number_websites_56 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_56.php">websites PHP v5.6</a>: $number_websites_56</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_56)">websites PHP v5.6</a>: $number_websites_56</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_70 -gt 0 ]]; then
|
if [[ $number_websites_70 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_70.php">websites PHP v7.0</a>: $number_websites_70</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_70)">websites PHP v7.0</a>: $number_websites_70</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_71 -gt 0 ]]; then
|
if [[ $number_websites_71 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_71.php">websites PHP v7.1</a>: $number_websites_71</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_71)">websites PHP v7.1</a>: $number_websites_71</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_72 -gt 0 ]]; then
|
if [[ $number_websites_72 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_72.php">websites PHP v7.2</a>: $number_websites_72</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_72)">websites PHP v7.2</a>: $number_websites_72</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_73 -gt 0 ]]; then
|
if [[ $number_websites_73 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_73.php">websites PHP v7.3</a>: $number_websites_73</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_73)">websites PHP v7.3</a>: $number_websites_73</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_74 -gt 0 ]]; then
|
if [[ $number_websites_74 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_74.php">websites PHP v7.4</a>: $number_websites_74</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_74)">websites PHP v7.4</a>: $number_websites_74</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_80 -gt 0 ]]; then
|
if [[ $number_websites_80 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_80.php">websites PHP v8.0</a>: $number_websites_80</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_80)">websites PHP v8.0</a>: $number_websites_80</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
if [[ $number_websites_81 -gt 0 ]]; then
|
if [[ $number_websites_81 -gt 0 ]]; then
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
<li><a href="websites_php_81.php">websites PHP v8.1</a>: $number_websites_81</li>
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_81)">websites PHP v8.1</a>: $number_websites_81</li>
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
cat <<EOF >> ${DST_PATH_PHP}/index.php
|
if [[ $number_websites_82 -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_82)">websites PHP v8.2</a>: $number_websites_82</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if [[ $number_websites_83 -gt 0 ]]; then
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
|
<li><a href="${WEB_DIR_CSV}/$(basename $filename_php_83)">websites PHP v8.3</a>: $number_websites_83</li>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat <<EOF >> ${DST_PATH_STATS}/index.html
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
136
create_vhost.sh
136
create_vhost.sh
@ -207,14 +207,25 @@ shopt -u extglob
|
|||||||
|
|
||||||
# - Determin httpd binary
|
# - Determin httpd binary
|
||||||
# -
|
# -
|
||||||
_httpd_binary="`which httpd`"
|
## - Determin httpd binary
|
||||||
|
## -
|
||||||
|
_httpd_binary="$(ps -axu | grep httpd \
|
||||||
|
| grep -e "^root" \
|
||||||
|
| grep -v grep \
|
||||||
|
| grep -v vim \
|
||||||
|
| grep -v bash \
|
||||||
|
| awk '{print$11}' | head -1)"
|
||||||
|
|
||||||
if [ -z "$_httpd_binary" ]; then
|
if [ -z "$_httpd_binary" ]; then
|
||||||
_httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
|
|
||||||
|
_httpd_binary="$(which httpd)"
|
||||||
|
|
||||||
if [ -z "$_httpd_binary" ]; then
|
if [ -z "$_httpd_binary" ]; then
|
||||||
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
if [ -x "/usr/local/apache2/bin/httpd" ]; then
|
||||||
_httpd_binary="/usr/local/apache2/bin/httpd"
|
_httpd_binary="/usr/local/apache2/bin/httpd"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# - Determin websever user/group
|
# - Determin websever user/group
|
||||||
@ -294,6 +305,34 @@ WEBSITES_ROOT_DIR=""
|
|||||||
CREATE_SYMLINK_WEB_BASE_DIR=false
|
CREATE_SYMLINK_WEB_BASE_DIR=false
|
||||||
|
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# - Determin timeout value
|
||||||
|
# ---
|
||||||
|
|
||||||
|
if [[ -f "/usr/local/apache2/conf/httpd.conf" ]]; then
|
||||||
|
_HTTPD_CONF_FILE="/usr/local/apache2/conf/httpd.conf"
|
||||||
|
elif [[ -f "/etc/apache2/apache2.conf" ]]; then
|
||||||
|
_HTTPD_CONF_FILE="/etc/apache2/apache2.conf"
|
||||||
|
else
|
||||||
|
_HTTPD_CONF_FILE=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${_HTTPD_CONF_FILE}" ]] && $(grep -q -i -E "^\s*Timeout\s+" "${_HTTPD_CONF_FILE}") ; then
|
||||||
|
_TIMEOUT="$(grep -i -E "^\s*timeout\s+" "${_HTTPD_CONF_FILE}"| awk '{print$2}' | head -1)"
|
||||||
|
else
|
||||||
|
_TIMEOUT=60
|
||||||
|
fi
|
||||||
|
if [[ -f "${_HTTPD_CONF_FILE}" ]] && $(grep -q -i -E "^\s*ProxyTimeout\s+" "${_HTTPD_CONF_FILE}") ; then
|
||||||
|
PROXY_TIMEOUT="$(grep -i -E "^\s*ProxyTimeout\s+" "${_HTTPD_CONF_FILE}"| awk '{print$2}' | head -1)"
|
||||||
|
else
|
||||||
|
PROXY_TIMEOUT=${_TIMEOUT}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# - END: Determin timeout value
|
||||||
|
# ---
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# - Read Configuration File (if exists)
|
# - Read Configuration File (if exists)
|
||||||
# -
|
# -
|
||||||
@ -813,7 +852,9 @@ if [ -z "$_existing_vhost_config_file" ]; then
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if [[ -n "$(trim $COMMON_LOGFILE_DIR)" ]]; then
|
if $_suEXEC ; then
|
||||||
|
__log_dir=${_web_base_dir}/logs
|
||||||
|
elif [[ -n "$(trim $COMMON_LOGFILE_DIR)" ]]; then
|
||||||
__log_dir="$COMMON_LOGFILE_DIR"
|
__log_dir="$COMMON_LOGFILE_DIR"
|
||||||
else
|
else
|
||||||
__log_dir=${_web_base_dir}/logs
|
__log_dir=${_web_base_dir}/logs
|
||||||
@ -1927,7 +1968,7 @@ if [ "$_type" = "PHP-FPM" ]; then
|
|||||||
tcp_host=127.0.0.1
|
tcp_host=127.0.0.1
|
||||||
tcp_port=9000
|
tcp_port=9000
|
||||||
_proxy_match="^/(.*\.php(/.*)?)\$ unix:$unix_socket|fcgi://$tcp_host:$tcp_port$_doc_root"
|
_proxy_match="^/(.*\.php(/.*)?)\$ unix:$unix_socket|fcgi://$tcp_host:$tcp_port$_doc_root"
|
||||||
_set_handler_fpm="\"proxy:unix:$unix_socket|fcgi://$tcp_host\""
|
_set_handler_fpm="\"proxy:unix:${unix_socket}|fcgi://php/\""
|
||||||
unix_socket_owner="$(stat -c '%U' $unix_socket)"
|
unix_socket_owner="$(stat -c '%U' $unix_socket)"
|
||||||
unix_socket_group="$(stat -c '%G' $unix_socket)"
|
unix_socket_group="$(stat -c '%G' $unix_socket)"
|
||||||
else
|
else
|
||||||
@ -3030,6 +3071,49 @@ elif [ "$_type" = "PHP-FPM" ]; then
|
|||||||
SetHandler $_set_handler_fpm
|
SetHandler $_set_handler_fpm
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|
||||||
|
# Define a matching worker.
|
||||||
|
# The part that is matched to the SetHandler is the part that
|
||||||
|
# follows the pipe. If you need to distinguish, "localhost; can
|
||||||
|
# be anything unique.
|
||||||
|
#
|
||||||
|
<Proxy "fcgi://php/">
|
||||||
|
|
||||||
|
# Recycle connections to the fastcgi dispatcher (PHP FPM).
|
||||||
|
#
|
||||||
|
# Use persistent connections to reduce the constant overhead of setting
|
||||||
|
# up new connections
|
||||||
|
#
|
||||||
|
ProxySet enablereuse=on
|
||||||
|
|
||||||
|
# max - the most proxied request per server
|
||||||
|
#
|
||||||
|
# max = pm.max_children / max number of servers
|
||||||
|
# = pm.max_children / (MaxRequestWorkers / ThreadsPerChild)
|
||||||
|
#
|
||||||
|
ProxySet max=16
|
||||||
|
|
||||||
|
# Forces the module to flush every chunk of data received from the FCGI backend
|
||||||
|
# as soon as it receives it, without buffering.
|
||||||
|
#
|
||||||
|
ProxySet flushpackets=on
|
||||||
|
|
||||||
|
# connectiontimeout
|
||||||
|
#
|
||||||
|
# Connect timeout in seconds. The number of seconds Apache httpd waits for the
|
||||||
|
# creation of a connection to the backend to complete. By adding a postfix of ms,
|
||||||
|
# the timeout can be also set in milliseconds.
|
||||||
|
#
|
||||||
|
ProxySet connectiontimeout=5
|
||||||
|
|
||||||
|
# timeout
|
||||||
|
#
|
||||||
|
# Socket timeout in seconds. The number of seconds Apache httpd waits for data
|
||||||
|
# sent by / to the backend.
|
||||||
|
#
|
||||||
|
#ProxySet timeout=${PROXY_TIMEOUT}
|
||||||
|
|
||||||
|
</Proxy>
|
||||||
|
|
||||||
<IfModule dir_module>
|
<IfModule dir_module>
|
||||||
DirectoryIndex index.php index.html index.htm
|
DirectoryIndex index.php index.html index.htm
|
||||||
</IfModule>
|
</IfModule>
|
||||||
@ -3133,6 +3217,48 @@ EOF
|
|||||||
SetHandler $_set_handler_fpm
|
SetHandler $_set_handler_fpm
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|
||||||
|
# Define a matching worker.
|
||||||
|
# The part that is matched to the SetHandler is the part that
|
||||||
|
# follows the pipe. If you need to distinguish, "localhost; can
|
||||||
|
# be anything unique.
|
||||||
|
#
|
||||||
|
<Proxy "fcgi://php/">
|
||||||
|
|
||||||
|
# Recycle connections to the fastcgi dispatcher (PHP FPM).
|
||||||
|
#
|
||||||
|
# Use persistent connections to reduce the constant overhead of setting
|
||||||
|
# up new connections
|
||||||
|
#
|
||||||
|
ProxySet enablereuse=on
|
||||||
|
|
||||||
|
# max - the most proxied request per server
|
||||||
|
#
|
||||||
|
# max = pm.max_children / max number of servers
|
||||||
|
# = pm.max_children / (MaxRequestWorkers / ThreadsPerChild)
|
||||||
|
#
|
||||||
|
ProxySet max=16
|
||||||
|
|
||||||
|
# Forces the module to flush every chunk of data received from the FCGI backend
|
||||||
|
# as soon as it receives it, without buffering.
|
||||||
|
#
|
||||||
|
ProxySet flushpackets=on
|
||||||
|
|
||||||
|
# connectiontimeout
|
||||||
|
#
|
||||||
|
# Connect timeout in seconds. The number of seconds Apache httpd waits for the
|
||||||
|
# creation of a connection to the backend to complete. By adding a postfix of ms,
|
||||||
|
# the timeout can be also set in milliseconds.
|
||||||
|
#
|
||||||
|
ProxySet connectiontimeout=5
|
||||||
|
|
||||||
|
# timeout
|
||||||
|
#
|
||||||
|
# Socket timeout in seconds. The number of seconds Apache httpd waits for data
|
||||||
|
# sent by / to the backend.
|
||||||
|
#
|
||||||
|
ProxySet timeout=30
|
||||||
|
</Proxy>
|
||||||
|
|
||||||
<IfModule dir_module>
|
<IfModule dir_module>
|
||||||
DirectoryIndex index.php index.html index.htm
|
DirectoryIndex index.php index.html index.htm
|
||||||
</IfModule>
|
</IfModule>
|
||||||
@ -3321,7 +3447,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echononl "\tCreate \"phpinfo.php\" file.."
|
echononl "\tCreate \"phpinfo.php\" file.."
|
||||||
if $CREATE_PHPINFO_FILE ; then
|
if $CREATE_PHPINFO_FILE && [ "$_type" = "PHP-FPM" -o "$_type" = "FCGID" ]; then
|
||||||
if [ ! -f "${_doc_root}/phpinfo.php" ]; then
|
if [ ! -f "${_doc_root}/phpinfo.php" ]; then
|
||||||
cat <<EOF > ${_doc_root}/phpinfo.php
|
cat <<EOF > ${_doc_root}/phpinfo.php
|
||||||
<html>
|
<html>
|
||||||
|
@ -207,7 +207,7 @@ if $delete_mode ; then
|
|||||||
[[ -n "$SCRIPT_remove_master_domain" ]] || SCRIPT_remove_master_domain="/root/bin/bind/bind_remove_domain_on_master.sh"
|
[[ -n "$SCRIPT_remove_master_domain" ]] || SCRIPT_remove_master_domain="/root/bin/bind/bind_remove_domain_on_master.sh"
|
||||||
[[ -n "$SCRIPT_remove_slave_domain" ]] || SCRIPT_remove_slave_domain="/root/bin/bind/bind_remove_domain_on_slave.sh"
|
[[ -n "$SCRIPT_remove_slave_domain" ]] || SCRIPT_remove_slave_domain="/root/bin/bind/bind_remove_domain_on_slave.sh"
|
||||||
|
|
||||||
[[ -n "$MYSQL_CREDENTIAL_ARGS" ]] || MYSQL_CREDENTIAL_ARGS="--login-path=local"
|
[[ -n "$MYSQL_CREDENTIAL_ARGS" ]] || MYSQL_CREDENTIAL_ARGS="-u root -S /run/mysqld/mysqld.sock"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -346,6 +346,7 @@ while IFS='' read -r -d '' fq_name ; do
|
|||||||
dirname="$(basename "$fq_name")"
|
dirname="$(basename "$fq_name")"
|
||||||
[[ "$dirname" = "DELETED" ]] && continue
|
[[ "$dirname" = "DELETED" ]] && continue
|
||||||
[[ "$dirname" = "BAK" ]] && continue
|
[[ "$dirname" = "BAK" ]] && continue
|
||||||
|
[[ "$dirname" = "MAINTENANCE" ]] && continue
|
||||||
[[ "$dirname" =~ ^Moved ]] && continue
|
[[ "$dirname" =~ ^Moved ]] && continue
|
||||||
if [[ $_num -eq 1 ]]; then
|
if [[ $_num -eq 1 ]]; then
|
||||||
_apache_additional_vhost_dirs="$(basename "$dirname")"
|
_apache_additional_vhost_dirs="$(basename "$dirname")"
|
||||||
|
Reference in New Issue
Block a user