- At apache service file 'apache2.service' set private temp directory to false (PrivateTmp=false).

- Support all running PFP FPM engines in vhost configuration '00default.conf'.
This commit is contained in:
Christoph 2017-12-29 03:36:11 +01:00
parent 600a1828af
commit 79404a83ad

View File

@ -61,7 +61,13 @@ shopt -u extglob
## - Is PHP-FPM socket in use
## -
_PHP_FPM_SOCKET="$(ls /tmp/php*.sock 2> /dev/null | head -1)"
declare -a _php_socket_arr=()
while IFS='' read -r -d '' _socket ; do
echo "socket: $_socket"
_php_major_version="$(echo "$_socket" | cut -d '-' -f2)"
_php_socket_arr+=("${_php_major_version}:$_socket")
done < <(find "/tmp" -type s -name "php*" -print0 | sort -z)
## - substitude path "/usr/local/httpd-$APACHE_VERSION" to "/usr/local/apache2"
## - in apache configuration files ?
@ -107,7 +113,7 @@ fi
## - Determin httpd binary
## -
_httpd_binary="`which httpd`"
_httpd_binary="$(which httpd)"
if [ -z "$_httpd_binary" ]; then
_httpd_binary="$(ps -axu | grep httpd | grep -e "^root" | grep -v grep | awk '{print$11}')"
if [ -z "$_httpd_binary" ]; then
@ -279,13 +285,6 @@ done
GLOBAL_DOC_ROOT="${BASE_WEBSPACE_DIR}/default"
SUEXEC_DOC_ROOT=$BASE_WEBSPACE_DIR
if [[ -n "$_PHP_FPM_SOCKET" ]]; then
PHP_FPM_SOCKET_PRESENT=true
PHP_MAJOR_VERSION=`echo $_PHP_FPM_SOCKET | cut -d '-' -f2`
else
PHP_FPM_SOCKET_PRESENT=false
fi
echo ""
echo ""
@ -740,6 +739,11 @@ clear
echo ""
echo -e "\033[21G\033[32mStart Apache Webserver Installation with the following Parameters \033[m"
echo ""
if [[ -n "$_httpd_current_version" ]]; then
echo ""
echo -e "--- Update form apache version \033[33m$_httpd_current_version\033[m ---"
echo ""
fi
echo "httpd version.................: $APACHE_VERSION"
echo " apr version................: $APR_VERSION"
echo " apr-uril version...........: $APR_UTIL_VERSION"
@ -789,6 +793,15 @@ if $WITH_MOD_PERL ; then
echo " mod_perl version...........: $MOD_PERL_VERSION"
fi
echo ""
if [[ ${#_php_socket_arr[@]} -gt 0 ]] ; then
echo -n "PHP FPM versions found........:"
for _val in ${_php_socket_arr[@]} ; do
IFS=':' read -a _val_arr <<< "${_val}"
echo -n " ${_val_arr[0]}"
done
echo
fi
echo ""
echononl "start with that configuration? [yes/no]: "
read OK
@ -826,6 +839,11 @@ touch ${_logdir}/main.log
echo "## -----------" >> ${_logdir}/main.log
echo "## - Start Apache Webserver installation with the following Parameters" >> ${_logdir}/main.log
echo "## -----------" >> ${_logdir}/main.log
if [[ -n "$_httpd_current_version" ]]; then
echo "## -" >> ${_logdir}/main.log
echo "## --- Update form apache version $_httpd_current_version ---" >> ${_logdir}/main.log
echo "## -" >> ${_logdir}/main.log
fi
echo "## -" >> ${_logdir}/main.log
echo "## - httpd version.................: $APACHE_VERSION" >> ${_logdir}/main.log
echo "## - apr version................: $APR_VERSION" >> ${_logdir}/main.log
@ -874,6 +892,15 @@ if $WITH_MOD_PERL ; then
echo "## - mod_perl version...........: $MOD_PERL_VERSION" >> ${_logdir}/main.log
fi
echo "## -" >> ${_logdir}/main.log
if [[ ${#_php_socket_arr[@]} -gt 0 ]] ; then
echo -n "PHP FPM versions found........:" >> ${_logdir}/main.log
for _val in ${_php_socket_arr[@]} ; do
IFS=':' read -a _val_arr <<< "${_val}"
echo -n " ${_val_arr[0]}" >> ${_logdir}/main.log
done
echo "## -" >> ${_logdir}/main.log
fi
echo "## -" >> ${_logdir}/main.log
echo "## - log directory installation....: $_logdir" >> ${_logdir}/main.log
echo "## -" >> ${_logdir}/main.log
echo "" >> ${_logdir}/main.log
@ -1605,29 +1632,35 @@ if $START_AT_BOOTTIME && $APACHE_WEBSERVICE_RUNNING ; then
error "Stopping Apache Webservice failed!"
fi
sleep 5
declare -i i=0
PIDS="$(ps aux | grep "$(realpath "$_httpd_binary")" | grep -v grep | awk '{print$2}')"
while [[ "X$PIDS" != "X" ]]; do
if [[ $i -eq 0 ]]; then
warn "Stopping Apache Webservice failed. Going to kill remaining httpd-processes.."
fi
if [[ $i -gt 10 ]]; then
error "Killing remaining httpd-processes failed !"
break
fi
for _PID in $PIDS ; do
kill -9 $_PID > /dev/null 2>&1
done
sleep 2
PIDS="$(ps aux | grep "$(realpath "$_httpd_binary")" | grep -v grep | awk '{print$2}')"
i=i+1
done
# # - Does NOT wor - don't know why
# # -
# declare -i i=0
# if [[ -n "$_httpd_binary" ]] ; then
#
# sleep 5
#
# PIDS="$(ps aux | grep "$(realpath "$_httpd_binary")" | grep -v grep | awk '{print$2}')"
#
# while [[ "X$PIDS" != "X" ]]; do
#
# if [[ $i -eq 0 ]]; then
# warn "Stopping Apache Webservice failed. Going to kill remaining httpd-processes.."
# fi
#
# if [[ $i -gt 10 ]]; then
# error "Killing remaining httpd-processes failed !"
# break
# fi
#
# for _PID in $PIDS ; do
# kill -9 $_PID > /dev/null 2>&1
# done
# sleep 2
# PIDS="$(ps aux | grep "$(realpath "$_httpd_binary")" | grep -v grep | awk '{print$2}')"
# i=i+1
# done
# fi
else
echo_skipped
@ -3230,7 +3263,7 @@ Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=${PREFIX}/bin/apachectl start
ExecStop=${PREFIX}/bin/apachectl stop
ExecReload=${PREFIX}/bin/apachectl graceful
PrivateTmp=true
PrivateTmp=false
Restart=on-abort
[Install]
@ -3249,7 +3282,7 @@ Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=${PREFIX}/bin/apachectl start
ExecStop=${PREFIX}/bin/apachectl stop
ExecReload=${PREFIX}/bin/apachectl graceful
PrivateTmp=true
PrivateTmp=false
Restart=on-abort
[Install]
@ -3427,15 +3460,21 @@ DirectoryIndex index.html index.htm index.php index.php5
DocumentRoot "$GLOBAL_DOC_ROOT"
EOF
if $PHP_FPM_SOCKET_PRESENT ; then
if [[ ${#_php_socket_arr[@]} -gt 0 ]] ; then
cat <<EOF >> ${PREFIX}/conf/vhosts/00default.conf
## - Make PHP-FPM status page and PHP-FPM ping available
## -
<FilesMatch "^(status-${PHP_MAJOR_VERSION}|ping-${PHP_MAJOR_VERSION})$">
SetHandler "proxy:unix:${_PHP_FPM_SOCKET}|fcgi://127.0.0.1"
EOF
for _val in ${_php_socket_arr[@]} ; do
IFS=':' read -a _val_arr <<< "${_val}"
cat <<EOF >> ${PREFIX}/conf/vhosts/00default.conf
<FilesMatch "^(status-${_val_arr[0]}|ping-${_val_arr[0]})">
SetHandler "proxy:unix:${_val_arr[1]}|fcgi://127.0.0.1"
</FilesMatch>
EOF
done
else
cat <<EOF >> ${PREFIX}/conf/vhosts/00default.conf