Accepting request 314699 from home:pgajdos
- 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
This commit is contained in:
151
start_apache2
151
start_apache2
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH
|
||||
# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH
|
||||
@@ -10,33 +10,54 @@
|
||||
# 2008, 2009, 2010
|
||||
#
|
||||
#
|
||||
pname=apache2
|
||||
. /usr/share/$pname/load_configuration
|
||||
|
||||
export ${!APACHE_*}
|
||||
. /usr/share/apache2/script-helpers
|
||||
|
||||
apache_link=/usr/sbin/httpd
|
||||
apache_bin=$(/usr/share/$pname/find_mpm 2>/dev/null)
|
||||
httpd_conf=${APACHE_HTTPD_CONF:-/etc/apache2/httpd.conf}
|
||||
#
|
||||
# which instance should we will run
|
||||
#
|
||||
|
||||
test -L $apache_link && apache_bin=$(readlink $apache_link)
|
||||
|
||||
if [ -z "$APACHE_MPM" ]; then
|
||||
APACHE_MPM=${apache_bin##*-}
|
||||
unset instance_suffix
|
||||
if [ -n "$HTTPD_INSTANCE" ]; then
|
||||
instance_suffix="@$HTTPD_INSTANCE"
|
||||
fi
|
||||
|
||||
if ! [ -x $apache_bin ]; then
|
||||
echo >&2 $apache_bin-$APACHE_MPM is not a valid httpd binary.
|
||||
echo >&2 Check your APACHE_MPM setting in /etc/sysconfig/$pname.
|
||||
exit 5
|
||||
fi
|
||||
|
||||
# a proper home should be set, otherwise the server might end up
|
||||
# with HOME=/root and some script might try to use that
|
||||
HOME=/var/lib/apache2
|
||||
#
|
||||
# load sysconfig variables APACHE_* from instance sysconfig
|
||||
# file
|
||||
#
|
||||
export SYSCONFIG_FILE=/etc/sysconfig/apache2${instance_suffix}
|
||||
load_sysconfig
|
||||
|
||||
unset server_flags
|
||||
#
|
||||
# server_flags: -DSSL and -DSYSCONFIG
|
||||
#
|
||||
if [ -f "$SYSCONFIG_FILE" ]; then
|
||||
server_flags="$server_flags -DSYSCONFIG"
|
||||
fi
|
||||
case "$action" in startssl) server_flags="-DSSL";; esac
|
||||
|
||||
|
||||
#
|
||||
# figure out correct apache2 binary (/usr/sbin/httpd-prefork,
|
||||
# /usr/sbin/httpd-worker, etc.) and serverflags
|
||||
#
|
||||
find_mpm
|
||||
if [ -n "$HTTPD_MPM" ]; then
|
||||
apache_bin="$HTTPD_SBIN_BASE-$HTTPD_MPM"
|
||||
if ! [ -x $apache_bin ]; then
|
||||
echo >&2 "$apache_bin-$APACHE_MPM is not a valid httpd binary."
|
||||
echo >&2 "Check your APACHE_MPM setting in /etc/sysconfig/apache2."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo >&2 "${warn}No Apache binary found. No MPM package installed? $norm"
|
||||
echo >&2 "Hint: install the apache2-prefork package, and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# server flags from APACHE_SERVER_FLAGS
|
||||
for i in $APACHE_SERVER_FLAGS; do
|
||||
case $i in
|
||||
-D) ;;
|
||||
@@ -44,8 +65,90 @@ for i in $APACHE_SERVER_FLAGS; do
|
||||
*) server_flags="$server_flags -D$i";;
|
||||
esac
|
||||
done
|
||||
${get_module_list_done:=false} || /usr/share/$pname/get_module_list && export get_module_list_done=true
|
||||
${get_includes:=false} || /usr/share/$pname/get_includes && export get_includes_done=true
|
||||
|
||||
export -n ${!APACHE_*}
|
||||
exec $apache_bin -f $httpd_conf $server_flags $@
|
||||
#
|
||||
# head configuration file
|
||||
#
|
||||
httpd_conf=${APACHE_HTTPD_CONF:-/etc/apache2${instance_suffix}/httpd.conf}
|
||||
|
||||
#
|
||||
# default values for some directives that should depend on instance
|
||||
#
|
||||
# PidFile
|
||||
default_pid_file=/var/run/httpd${instance_suffix}.pid
|
||||
|
||||
unset sysconfig_setting
|
||||
#
|
||||
# involve the sysconfig variables
|
||||
#
|
||||
# APACHE_ACCESS_LOG
|
||||
if [ -n "$APACHE_ACCESS_LOG" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "CustomLog $APACHE_ACCESS_LOG")
|
||||
fi
|
||||
# APACHE_CONF_INCLUDE_FILES
|
||||
for file in $APACHE_CONF_INCLUDE_FILES; do
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "Include $file")
|
||||
done
|
||||
# APACHE_CONF_INCLUDE_DIRS
|
||||
for dir in $APACHE_CONF_INCLUDE_DIRS; do
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "Include $dir")
|
||||
done
|
||||
# APACHE_SERVERADMIN
|
||||
if [ -n "$APACHE_SERVERADMIN" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "ServerAdmin $APACHE_SERVERADMIN")
|
||||
fi
|
||||
# APACHE_SERVERNAME
|
||||
if [ -n "$APACHE_SERVERNAME" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "ServerName $APACHE_SERVERNAME")
|
||||
fi
|
||||
# APACHE_START_TIMEOUT
|
||||
# not used nowadays
|
||||
# APACHE_SERVERSIGNATURE
|
||||
if [ -n "$APACHE_SERVERSIGNATURE" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "ServerSignature $APACHE_SERVERSIGNATURE")
|
||||
fi
|
||||
# APACHE_LOGLEVEL
|
||||
if [ -n "$APACHE_LOGLEVEL" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "LogLevel $APACHE_LOGLEVEL")
|
||||
fi
|
||||
# APACHE_USE_CANONICAL_NAME
|
||||
if [ -n "$APACHE_USE_CANONICAL_NAME" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "UseCanonicalName $APACHE_USE_CANONICAL_NAME")
|
||||
fi
|
||||
# APACHE_SERVERTOKENS
|
||||
if [ -n "$APACHE_SERVERTOKENS" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "ServerTokens $APACHE_SERVERTOKENS")
|
||||
fi
|
||||
# APACHE_EXTENDED_STATUS
|
||||
if [ -n "$APACHE_EXTENDED_STATUS" ]; then
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "ExtendedStatus $APACHE_EXTENDED_STATUS")
|
||||
fi
|
||||
# APACHE_MODULES
|
||||
get_module_list
|
||||
module_ids=($HTTPD_MODULE_IDS)
|
||||
module_paths=($HTTPD_MODULE_PATHS)
|
||||
for i in "${!module_ids[@]}"; do
|
||||
sysconfig_setting=("${sysconfig_setting[@]}" "-C" "LoadModule ${module_ids[$i]} ${module_paths[$i]}")
|
||||
done
|
||||
|
||||
#
|
||||
# a proper home should be set, otherwise the server might end up
|
||||
# with HOME=/root and some script might try to use that
|
||||
#
|
||||
HOME=/var/lib/apache2${instance_suffix}
|
||||
|
||||
#
|
||||
# run Apache
|
||||
#
|
||||
|
||||
echo Running $apache_bin -f $httpd_conf $server_flags \
|
||||
-C "PidFile $default_pid_file" \
|
||||
"${sysconfig_setting[@]}" \
|
||||
$@
|
||||
exec $apache_bin -f $httpd_conf $server_flags \
|
||||
-C "PidFile $default_pid_file" \
|
||||
"${sysconfig_setting[@]}" \
|
||||
$@
|
||||
|
||||
exit 0
|
||||
|
||||
|
Reference in New Issue
Block a user