2424if [[ ! -n $( find ${APP_HOME_DIR} -maxdepth 1 -type f) ]] && [[ -d ${APP_HOME_DIR_TEMPLATE} ]]; then
2525 echo Home directory ${APP_HOME_DIR} exists but is empty - populate it using ${APP_HOME_DIR_TEMPLATE} ...
2626 cp -rf ${APP_HOME_DIR_TEMPLATE} /. ${APP_HOME_DIR} /
27- elif [[ ! -d ${APP_HOME_DIR} /bin || ! -n $( find ${APP_HOME_DIR} /bin -maxdepth 1 -type f) ]] && [[ -d ${APP_HOME_DIR_TEMPLATE} /bin ]]; then
28- echo Home directory ${APP_HOME_DIR} /bin is missing or empty empty - populate it using ${APP_HOME_DIR_TEMPLATE} /bin...
29- cp -rf ${APP_HOME_DIR_TEMPLATE} /bin ${APP_HOME_DIR} /
30- elif [[ ! -d ${APP_HOME_DIR} /public_html ]]; then
31- echo ERROR: ${APP_HOME_DIR} /public_html not found.
32- exit 1
3327fi
3428
35- # Correct permissions (750) must be set on the bin directory and the php-wrapper
36- if [[ ! " $( stat -c %a ${APP_HOME_DIR} /bin) " == " 750" ]]; then
37- echo ERROR: Permissions on ${APP_HOME_DIR} /bin must be 750...
38- # exit 1
39- elif [[ ! " $( stat -c %a ${APP_HOME_DIR} /bin/php-wrapper) " == " 750" ]]; then
40- echo ERROR: Permissions on ${APP_HOME_DIR} /bin/php-wrapper must be 750...
41- # exit 1
29+ # Document root directory is required
30+ if [[ ! -d ${APP_HOME_DIR} /public_html ]]; then
31+ echo ERROR: ${APP_HOME_DIR} /public_html not found.
32+ exit 1
4233fi
4334
4435# If users need to change the vhost.conf the SSL version can be rebuilt if it is deleted
@@ -56,7 +47,7 @@ if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]] && [[ ! -f ${APP_HOME_DIR}/vho
5647 -e ' s~#SSLCipherSuite \(.*\)$~SSLCipherSuite \1~g' \
5748 -e ' s~#SSLCertificateFile \(.*\)$~SSLCertificateFile \1~g' \
5849 -e ' s~#SSLCertificateKeyFile \(.*\)$~SSLCertificateKeyFile \1~g' \
59- /var/www/app /vhost-ssl.conf
50+ ${APP_HOME_DIR} /vhost-ssl.conf
6051fi
6152
6253# Enable/Disable SSL support
@@ -66,7 +57,7 @@ if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]]; then
6657
6758 sed -i \
6859 -e ' s~^#NameVirtualHost \*:443$~NameVirtualHost \*:443~g' \
69- -e ' s~^#Include /var/www/app/ vhost-ssl.conf$~Include /var/www/app /vhost-ssl.conf~g' \
60+ -e ' s~^#Include ${APP_HOME_DIR}/ vhost-ssl.conf$~Include ${APP_HOME_DIR} /vhost-ssl.conf~g' \
7061 /etc/httpd/conf/httpd.conf
7162
7263 if [[ ! -f /etc/services-config/ssl/private/localhost.key ]] || [[ ! -f /etc/services-config/ssl/certs/localhost.crt ]]; then
8576
8677 sed -i \
8778 -e ' s~^NameVirtualHost \*:443$~#NameVirtualHost \*:443~g' \
88- -e ' s~^Include /var/www/app/ vhost-ssl.conf$~#Include /var/www/app /vhost-ssl.conf~g' \
79+ -e ' s~^Include ${APP_HOME_DIR}/ vhost-ssl.conf$~#Include ${APP_HOME_DIR} /vhost-ssl.conf~g' \
8980 /etc/httpd/conf/httpd.conf
9081fi
9182
10091
10192# Set the Apache (run) service user/group
10293if [[ ${OPTS_SUEXECUSERGROUP} == " true" ]]; then
103- sed -i -e " s~^User .*$~User ${OPTS_SERVICE_USER_GROUP} ~g" -e " s~^Group .*$~Group ${OPTS_SERVICE_USER_GROUP} ~g" -e " s~^LogLevel warn$~LogLevel debug~g" /etc/httpd/conf/httpd.conf
104- sed -i -e ' s~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' /var/www/app/vhost.conf
105- sed -i -e ' s~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' /var/www/app/vhost-ssl.conf
106- chown -R 502:502 /var/{www/app/bin,www/.app-skel/bin,run/mod_fcgid}
94+ sed -i -e " s~^User .*$~User ${OPTS_SERVICE_USER_GROUP} ~g" \
95+ -e " s~^Group .*$~Group ${OPTS_SERVICE_USER_GROUP} ~g" /etc/httpd/conf/httpd.conf
96+ sed -i -e ' s~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' ${APP_HOME_DIR} /vhost.conf
97+ sed -i -e ' s~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' ${APP_HOME_DIR} /vhost-ssl.conf
98+ chown -R 502:502 /var/{www/app-bin,run/mod_fcgid}
10799else
108- sed -i -e " s~^User .*$~User apache~g" -e " s~^Group .*$~Group apache~g" /etc/httpd/conf/httpd.conf
109- sed -i -e ' s~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' /var/www/app/vhost.conf
110- sed -i -e ' s~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' /var/www/app/vhost-ssl.conf
111- chown -R apache:apache /var/{www/app/bin,www/.app-skel/bin,run/mod_fcgid}
100+ sed -i -e " s~^User .*$~User apache~g" \
101+ -e " s~^Group .*$~Group apache~g" /etc/httpd/conf/httpd.conf
102+ sed -i -e ' s~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' ${APP_HOME_DIR} /vhost.conf
103+ sed -i -e ' s~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' ${APP_HOME_DIR} /vhost-ssl.conf
104+ chown -R apache:apache /var/{www/app-bin,run/mod_fcgid}
112105fi
113106
107+ # Update any existing instances of php-wrapper path in the Virtual Host
108+ sed -i -e ' s~app/bin/php-wrapper~app-bin/php-wrapper~g' ${APP_HOME_DIR} /vhost.conf
109+ sed -i -e ' s~app/bin/php-wrapper~app-bin/php-wrapper~g' ${APP_HOME_DIR} /vhost-ssl.conf
110+
114111echo Loading Apache modules...
115112for MODULE in ${APACHE_LOAD_MODULES}
116113do
@@ -124,16 +121,15 @@ done
124121echo " ${OPTS_SERVICE_USER} :${OPTS_SERVICE_USER_PASSWORD} " | chpasswd
125122echo " ${OPTS_SERVICE_USER_GROUP} :${OPTS_SERVICE_USER_GROUP_PASSWORD} " | chpasswd
126123
127- echo
128- echo " ================================================================================"
129- echo " Apache Credentials"
130- echo " --------------------------------------------------------------------------------"
131- echo " ${OPTS_SERVICE_USER} : ${OPTS_SERVICE_USER_PASSWORD} "
132- echo " ${OPTS_SERVICE_USER_GROUP} : ${OPTS_SERVICE_USER_GROUP_PASSWORD} "
133- echo " --------------------------------------------------------------------------------"
134- echo
135-
136- # Allow some time for supervisor_stdout to start
137- sleep 2
124+ cat << -EOT
125+
126+ ================================================================================
127+ Apache Credentials
128+ --------------------------------------------------------------------------------
129+ ${OPTS_SERVICE_USER} : ${OPTS_SERVICE_USER_PASSWORD}
130+ ${OPTS_SERVICE_USER_GROUP} : ${OPTS_SERVICE_USER_GROUP_PASSWORD}
131+ --------------------------------------------------------------------------------
132+
133+ EOT
138134
139135exit 0
0 commit comments