Kristyna Streitova
924136ec0d
- allow to run multiple instances of Apache on one system [fate#317786] (internal) * distributed httpd.conf no longer includes sysconfig.d, nor this directory is shipped. httpd.conf includes loadmodule.conf and global.conf which are former sysconfig.d/loadmodule.conf and sysconfig.d/global.conf for default /etc/sysconfig/apache2 global.conf and loadmodule.conf are not included when sysconfig variables could have been read by start_apache2 startup script (run with systemd services). Therefore, when starting server via /usr/sbin/httpd, sysconfig variables are not taken into account. * some not-maintained scripts are moved from /usr/share/apache2 to /usr/share/apache2/deprecated-scripts * all modules comment in sysconfig file is not generated anymore * added README-instances.txt * removed Sources: load_configuration find_mpm get_module_list get_includes find_httpd_includes apache-find-directives * added Sources: deprecated-scripts.tar.xz apache2-README-instances.txt apache2-loadmodule.conf apache2-global.conf apache2-find-directives apache2@.service OBS-URL: https://build.opensuse.org/request/show/314699 OBS-URL: https://build.opensuse.org/package/show/Apache/apache2?expand=0&rev=452
116 lines
2.7 KiB
Bash
116 lines
2.7 KiB
Bash
#!/bin/bash
|
|
|
|
HTTPD_SBIN_BASE="/usr/sbin/httpd"
|
|
|
|
#
|
|
# loads sysconfig variables into environment
|
|
#
|
|
# return value in: APACHE_*
|
|
#
|
|
function load_sysconfig
|
|
{
|
|
[ -n "$sysconfig_loaded" ] && return
|
|
[ ! -f "$SYSCONFIG_FILE" ] && return
|
|
|
|
. $SYSCONFIG_FILE
|
|
|
|
export ${!APACHE_*} sysconfig_loaded=true
|
|
}
|
|
|
|
#
|
|
# finds prefered multiprocessing module
|
|
#
|
|
# return value in: HTTPD_MPM
|
|
#
|
|
|
|
function find_mpm
|
|
{
|
|
[ -n "$mpm_found" ] && return
|
|
|
|
# load sysconfig variables if they weren't yet
|
|
load_sysconfig
|
|
|
|
# try to read from sysconfig's APACHE_MPM
|
|
HTTPD_MPM=$APACHE_MPM
|
|
# if empty, then choose one from installed
|
|
if [ -z "$HTTPD_MPM" ]; then
|
|
# guess
|
|
for i in $HTTPD_SBIN_BASE-*; do
|
|
test -f $i || continue
|
|
i=$(basename $i)
|
|
i=${i#*-}
|
|
installed_mpms=(${installed_mpms[*]} $i)
|
|
done
|
|
if [ -z "${installed_mpms[*]}" ]; then
|
|
HTTPD_MPM=""
|
|
return
|
|
elif [ ${#installed_mpms[*]} = 1 ]; then
|
|
HTTPD_MPM=${installed_mpms[*]}
|
|
else
|
|
case ${installed_mpms[*]} in
|
|
*prefork*) HTTPD_MPM=prefork;;
|
|
*worker*) HTTPD_MPM=worker;;
|
|
*event*) HTTPD_MPM=event;;
|
|
esac
|
|
fi
|
|
fi
|
|
|
|
export HTTPD_MPM mpm_found=true
|
|
}
|
|
|
|
#
|
|
# search for paths for wanted modules (declared in
|
|
# APACHE_MODULES)
|
|
#
|
|
# return value in: HTTPD_MODULE_IDS
|
|
# HTTPD_MODULE_PATHS
|
|
#
|
|
|
|
function get_module_list
|
|
{
|
|
load_sysconfig
|
|
find_mpm
|
|
|
|
for module in $APACHE_MODULES; do
|
|
# special case
|
|
# remove or add 'd' on in cgi module name
|
|
case $module in mod_cgid|cgid)
|
|
case $HTTPD_MPM in prefork) module=${module%d};; esac;;
|
|
esac
|
|
case $module in mod_cgi|cgi)
|
|
case $HTTPD_MPM in event|worker) module=${module}d;; esac;;
|
|
esac
|
|
|
|
module_id=${module#mod_}_module
|
|
|
|
# special case
|
|
case $module_id in auth_mysql_module) module_id=mysql_auth_module;; esac
|
|
|
|
unset module_path
|
|
for libdir in /usr/lib64 /usr/lib; do
|
|
for filepath in $libdir/apache2-$HTTPD_MPM/mod_$module.so \
|
|
$libdir/apache2-$HTTPD_MPM/$module.so \
|
|
$libdir/apache2/mod_$module.so \
|
|
$libdir/apache2/$module.so; do
|
|
if [ -f $filepath ]; then
|
|
module_path=$filepath
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ -n "$module_path" ]; then
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ -n "$module_path" ]; then
|
|
HTTPD_MODULE_IDS="$HTTPD_MODULE_IDS $module_id"
|
|
HTTPD_MODULE_PATHS="$HTTPD_MODULE_PATHS $module_path"
|
|
fi
|
|
done
|
|
|
|
export HTTPD_MODULE_IDS
|
|
export HTTPD_MODULE_PATHS
|
|
}
|
|
|