@@ -250,13 +250,25 @@ update_user_login ()
250250
251251DEFAULT_SYSTEM_USER=app
252252DEFAULT_APACHE_USER=app-www
253+ DEFAULT_APACHE_LOAD_MODULES="
254+ authz_user_module
255+ log_config_module
256+ expires_module
257+ deflate_module
258+ headers_module
259+ setenvif_module
260+ mime_module
261+ status_module
262+ dir_module
263+ alias_module
264+ "
253265PACKAGE_PATH=${PACKAGE_PATH:-/ opt/ app}
254266PASSWORD_LENGTH=16
255267
256268OPTS_APACHE_CONTENT_ROOT=" $( get_apache_content_root) "
257269OPTS_APACHE_DOCUMENT_ROOT=" ${OPTS_APACHE_CONTENT_ROOT} /$( get_apache_public_directory) "
258270OPTS_APACHE_EXTENDED_STATUS_ENABLED=" ${APACHE_EXTENDED_STATUS_ENABLED:- false} "
259- OPTS_APACHE_LOAD_MODULES=" ${APACHE_LOAD_MODULES:- authz_user_module log_config_module expires_module deflate_module headers_module setenvif_module mime_module status_module dir_module alias_module reqtimeout_module } "
271+ OPTS_APACHE_LOAD_MODULES=" ${APACHE_LOAD_MODULES:- ${DEFAULT_APACHE_LOAD_MODULES} } "
260272OPTS_APACHE_MOD_SSL_ENABLED=" ${APACHE_MOD_SSL_ENABLED:- false} "
261273OPTS_APACHE_RUN_GROUP=" ${APACHE_RUN_GROUP:- ${DEFAULT_APACHE_USER} } "
262274OPTS_APACHE_RUN_USER=" ${APACHE_RUN_USER:- ${DEFAULT_APACHE_USER} } "
@@ -278,7 +290,9 @@ if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == true ]] \
278290 -days 365 \
279291 -subj " /C=--/ST=STATE/L=LOCALITY/O=ORGANIZATION/CN=${OPTS_APACHE_SERVER_NAME} " \
280292 -keyout /etc/services-config/ssl/private/localhost.key \
281- -out /etc/services-config/ssl/certs/localhost.crt &
293+ -out /etc/services-config/ssl/certs/localhost.crt \
294+ &
295+
282296 PIDS[2]=${! }
283297fi
284298
@@ -341,20 +355,22 @@ HTTPD=${HTTPD:-${HTTPD_MPM_PREFORK}}
341355if [[ ${HTTPD} == ${HTTPD_MPM_PREFORK} ]]; then
342356 echo " Apache Server MPM: Prefork"
343357 sed -i \
344- -e " s~HTTPD=${HTTPD_MPM_WORKER} ~#HTTPD=${HTTPD_MPM_WORKER} ~g" \
345- /etc/sysconfig/httpd
358+ -e " s~HTTPD=${HTTPD_MPM_WORKER} ~#HTTPD=${HTTPD_MPM_WORKER} ~g" \
359+ /etc/sysconfig/httpd
346360elif [[ ${HTTPD} == ${HTTPD_MPM_WORKER} ]]; then
347361 echo " Apache Server MPM: Worker"
348362 sed -i \
349- -e " s~#HTTPD=${HTTPD_MPM_WORKER} ~HTTPD=${HTTPD_MPM_WORKER} ~g" \
350- /etc/sysconfig/httpd
363+ -e " s~#HTTPD=${HTTPD_MPM_WORKER} ~HTTPD=${HTTPD_MPM_WORKER} ~g" \
364+ /etc/sysconfig/httpd
351365else
352366 echo " ERROR: Apache Server MPM (${HTTPD} ) unknown."
353367 exit 1
354368fi
355369
356370# Add local hosts entries
357- add_hosts_entry 127.0.0.1 ${OPTS_APACHE_SERVER_NAME}${OPTS_APACHE_SERVER_ALIAS: + }${OPTS_APACHE_SERVER_ALIAS}
371+ add_hosts_entry \
372+ 127.0.0.1 \
373+ ${OPTS_APACHE_SERVER_NAME}${OPTS_APACHE_SERVER_ALIAS: + }${OPTS_APACHE_SERVER_ALIAS}
358374
359375# Set Apache EnableSendfile
360376if [[ ${APACHE_DOCUMENT_ROOT_FILE_SYSTEM} == nfs ]]; then
@@ -380,9 +396,11 @@ if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == true ]] \
380396 && [[ -f ${OPTS_APACHE_CONTENT_ROOT} /vhost.conf ]]; then
381397 echo " Generating SSL VirtualHost configuration."
382398
399+ SED_UNCOMMENT=' s~\( *\)\(#\( \([^ ]\)\)\?\)\(.*\)$~\1\4\5~'
400+
383401 sed \
384402 -e ' s~^<VirtualHost \*:80 \*:8443>$~<VirtualHost \*:443>~g' \
385- -e ' /<IfModule mod_ssl.c>/,/<\/IfModule>/ s~\( *\)\(#\( \([^ ]\)\)\?\)\(.*\)$~\1\4\5~ ' \
403+ -e " /<IfModule mod_ssl.c>/,/<\/IfModule>/ ${SED_UNCOMMENT} " \
386404 ${OPTS_APACHE_CONTENT_ROOT} /vhost.conf > \
387405 ${OPTS_APACHE_CONTENT_ROOT} /vhost-ssl.conf
388406fi
@@ -413,11 +431,12 @@ else
413431 ${VIRTUAL_HOST_CONFIGURATION_FILES}
414432fi
415433
416- # Set correct ownership for fcgid php-wrapper and socket
417- chown -R \
418- ${OPTS_APACHE_RUN_USER} :${OPTS_APACHE_RUN_GROUP} \
419- /var/{www/app-bin,run/mod_fcgid} \
420- & > /dev/null
434+ # Set ownership for fcgid php-wrapper and socket if necessary
435+ if [[ -d /var/www/app-bin && -d /var/run/mod_fcgid ]]; then
436+ chown -R \
437+ ${OPTS_APACHE_RUN_USER} :${OPTS_APACHE_RUN_GROUP} \
438+ /var/{www/app-bin,run/mod_fcgid}
439+ fi
421440
422441# Set the system user's login names and groups
423442update_user_login ${DEFAULT_SYSTEM_USER} ${OPTS_APACHE_SYSTEM_USER}
0 commit comments