Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 129edf5

Browse files
committed
Merge pull request #36 from jdeathe/master
Release changes ready for centos-6-1.3.1
2 parents 3010ce2 + ad287b7 commit 129edf5

File tree

8 files changed

+450
-272
lines changed

8 files changed

+450
-272
lines changed

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
# CentOS-6, Apache 2.2, PHP 5.3, PHP memcached 1.0, PHP APC 3.1, Composer
55
#
66
# =============================================================================
7-
FROM jdeathe/centos-ssh-apache-php:centos-6-1.3.0
7+
FROM jdeathe/centos-ssh-apache-php:centos-6-1.3.1
88

99
MAINTAINER James Deathe <james.deathe@gmail.com>
1010

1111
# -----------------------------------------------------------------------------
1212
# FastCGI support
1313
# -----------------------------------------------------------------------------
14-
RUN yum --setopt=tsflags=nodocs -y install \
14+
RUN rpm --rebuilddb \
15+
&& yum --setopt=tsflags=nodocs -y install \
1516
fcgi-2.4.0-12.el6 \
1617
mod_fcgid-2.3.9-1.el6 \
1718
&& yum versionlock add \
@@ -24,14 +25,14 @@ RUN yum --setopt=tsflags=nodocs -y install \
2425
# Apache mime_magic module should be disabled with FastCGI
2526
# -----------------------------------------------------------------------------
2627
RUN sed -i \
27-
-e 's~^LoadModule mime_magic_module modules/mod_mime_magic.so~#LoadModule mime_magic_module modules/mod_mime_magic.so~g' \
28+
-e 's~^LoadModule mime_magic_module ~#LoadModule mime_magic_module ~g' \
2829
/etc/httpd/conf/httpd.conf
2930

3031
# -----------------------------------------------------------------------------
3132
# Enable the pathinfo fix
3233
# -----------------------------------------------------------------------------
3334
RUN sed -i \
34-
-e 's~^;cgi.fix_pathinfo=1~cgi.fix_pathinfo = 1~g' \
35+
-e 's~^;cgi.fix_pathinfo=1$~cgi.fix_pathinfo=1~g' \
3536
/etc/php.ini
3637

3738
# -----------------------------------------------------------------------------

README.md

Lines changed: 119 additions & 78 deletions
Large diffs are not rendered by default.

apache-php.app-1.1.1@8080.service

Lines changed: 62 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# Create a data container for the configuration volume:
33
# docker run -v /config --name volume-config.<service-name> busybox /bin/true
44
#
5+
# Optional configuration volume install:
6+
# mkdir -p /etc/services-config/<service-name>/{httpd,supervisor,ssl/{certs,private}}
7+
# cp <container-path>/etc/services-config/supervisor/supervisord.conf /etc/services-config/<service-name>/supervisor/supervisord.conf
8+
# cp <container-path>/etc/services-config/httpd/conf/httpd.conf /etc/services-config/<service-name>/httpd/conf/httpd.conf
9+
# cp <container-path>/etc/services-config/httpd/conf.d/php.conf /etc/services-config/<service-name>/httpd/conf.d/php.conf
10+
# cp <container-path>/etc/services-config/httpd/conf.d/ssl.conf /etc/services-config/<service-name>/httpd/conf.d/ssl.conf
11+
#
512
# To install:
613
# sudo cp <container-path>/<service-name>@<port>.service /etc/systemd/system/
714
# sudo systemctl daemon-reload
@@ -13,69 +20,89 @@
1320

1421
[Unit]
1522
Description=CentOS-6 / Apache / PHP (FastCGI) // app-1.1.1
16-
After=etcd.service
23+
After=etcd2.service
1724
After=docker.service
1825
Requires=docker.service
19-
Requires=etcd.service
26+
Requires=etcd2.service
2027

2128
[Service]
2229
Restart=on-failure
2330
RestartSec=30
2431
TimeoutStartSec=1200
32+
Environment="MOUNT_PATH_CONFIG=/etc/services-config"
33+
Environment="MOUNT_PATH_DATA=/var/services-data"
34+
Environment="DOCKER_IMAGE_NAME=jdeathe/centos-ssh-apache-php-fcgi"
35+
Environment="DOCKER_IMAGE_TAG=centos-6-1.3.1"
2536

2637
# Create a data container for the configuration volume
2738
ExecStartPre=/bin/sudo /bin/bash -c \
28-
"if [ ! \"busybox\" == \"$(/usr/bin/docker images | /bin/grep -e '^busybox[ ]\{1,\}' | /bin/grep -o 'busybox')\" ]; then \
29-
if [ -f /var/services-packages/busybox.latest-1.0.0.tar.xz ]; then \
30-
/usr/bin/xz -dc /var/services-packages/busybox.latest-1.0.0.tar.xz | /usr/bin/docker load; \
39+
"if [[ busybox != $(/usr/bin/docker images | /bin/grep -e '^busybox[ ]\{1,\}' | /bin/grep -o 'busybox') ]]; then \
40+
if [[ -f /var/services-packages/busybox.latest-1.0.0.tar.xz ]]; then \
41+
/usr/bin/xz /var/services-packages/busybox.latest-1.0.0.tar.xz | /usr/bin/docker load; \
3142
else \
3243
/usr/bin/docker pull busybox:latest; \
3344
fi; \
3445
fi; \
35-
if [ ! \"volume-config.%p\" == \"$(/usr/bin/docker ps -a | /bin/grep -v -e \\\"volume-config.%p/.*,.*\\\" | /bin/grep -e '[ ]\{1,\}'volume-config.%p | /bin/grep -o volume-config.%p)\" ]; then \
36-
/usr/bin/docker run \
37-
--name volume-config.%p \
38-
-v /etc/services-config/ssh.pool-1/ssh:/etc/services-config/ssh \
39-
-v /etc/services-config/%p/supervisor:/etc/services-config/supervisor \
40-
-v /etc/services-config/%p/httpd:/etc/services-config/httpd \
41-
-v /etc/services-config/%p/ssl/certs:/etc/services-config/ssl/certs \
42-
-v /etc/services-config/%p/ssl/private:/etc/services-config/ssl/private \
43-
busybox:latest \
44-
/bin/true; \
46+
if [[ -n $(/usr/bin/find ${MOUNT_PATH_CONFIG}/%p/supervisor -maxdepth 1 -type f) ]] && [[ -n $(/usr/bin/find ${MOUNT_PATH_CONFIG}/%p/httpd -maxdepth 1 -type f) ]]; then \
47+
if [[ volume-config.%p != $(/usr/bin/docker ps -a | /bin/awk -v pattern='^volume-config.%p$' '$NF ~ pattern { print $NF; }') ]]; then \
48+
/usr/bin/docker run \
49+
--name volume-config.%p \
50+
-v ${MOUNT_PATH_CONFIG}/ssh.pool-1/ssh:/etc/services-config/ssh \
51+
-v ${MOUNT_PATH_CONFIG}/%p/supervisor:/etc/services-config/supervisor \
52+
-v ${MOUNT_PATH_CONFIG}/%p/httpd:/etc/services-config/httpd \
53+
-v ${MOUNT_PATH_CONFIG}/%p/ssl/certs:/etc/services-config/ssl/certs \
54+
-v ${MOUNT_PATH_CONFIG}/%p/ssl/private:/etc/services-config/ssl/private \
55+
busybox:latest \
56+
/bin/true; \
57+
fi; \
4558
fi"
4659

4760
# Initialisation: Pull or build image if required
4861
ExecStartPre=/bin/sudo /bin/bash -c \
49-
"if [ ! \"jdeathe/centos-ssh-apache-php-fcgi\" == \"$(/usr/bin/docker images | /bin/grep -e '^jdeathe/centos-ssh-apache-php-fcgi[ ]\{1,\}' | /bin/grep -o 'jdeathe/centos-ssh-apache-php-fcgi')\" ]; then \
50-
if [ -f /var/services-packages/jdeathe/centos-ssh-apache-php-fcgi.centos-6-1.3.0.tar.xz ]; then \
51-
/usr/bin/xz -dc /var/services-packages/jdeathe/centos-ssh-apache-php-fcgi.centos-6-1.3.0.tar.xz | /usr/bin/docker load; \
62+
"if [[ ${DOCKER_IMAGE_NAME} != $(/usr/bin/docker images | /bin/grep -e \\\"^${DOCKER_IMAGE_NAME}[ ]\{1,\}\\\" | /bin/grep -o \\\"${DOCKER_IMAGE_NAME}\\\") ]]; then \
63+
if [[ -f /var/services-packages/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz ]]; then \
64+
/usr/bin/xz -dc /var/services-packages/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz | /usr/bin/docker load; \
5265
else \
53-
/usr/bin/docker pull jdeathe/centos-ssh-apache-php-fcgi:centos-6-1.3.0; \
66+
/usr/bin/docker pull ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}; \
5467
fi; \
5568
fi"
5669

5770
# Startup: Remove existing container (and stop if running) so it is re-created on startup but not removed on exit - to allow debugging if required
5871
ExecStart=/bin/sudo /bin/bash -c \
59-
"if [ \"%p\" == \"$(/usr/bin/docker ps -a | /bin/grep -v -e \\\"%p/.*,.*\\\" | /bin/grep -e '[ ]\{1,\}'%p | /bin/grep -o %p)\" ]; then \
60-
if [ \"%p\" == \"$(/usr/bin/docker ps | /bin/grep -v -e \\\"%p/.*,.*\\\" | /bin/grep -e '[ ]\{1,\}'%p | /bin/grep -o %p)\" ]; then \
72+
"if [[ %p == $(/usr/bin/docker ps -a | /bin/awk -v pattern='^%p$' '$NF ~ pattern { print $NF; }') ]]; then \
73+
if [[ %p == $(/usr/bin/docker ps | /bin/awk -v pattern='^%p$' '$NF ~ pattern { print $NF; }') ]]; then \
6174
/usr/bin/docker stop %p; \
6275
fi; \
6376
/usr/bin/docker rm %p; \
6477
fi; \
65-
/usr/bin/docker run \
66-
--privileged \
67-
--name %p \
68-
-p %i:80 \
69-
-p 8580:8443 \
70-
--env SERVICE_UNIT_INSTANCE=app-1 \
71-
--env SERVICE_UNIT_LOCAL_ID=1 \
72-
--env SERVICE_UNIT_INSTANCE=1 \
73-
--env APACHE_SERVER_NAME=app-1.local \
74-
--env APACHE_SERVER_ALIAS=app-1 \
75-
--env DATE_TIMEZONE=UTC \
76-
--volumes-from volume-config.%p \
77-
-v /var/services-data/apache-php/app-1:/var/www/app \
78-
jdeathe/centos-ssh-apache-php-fcgi:centos-6-1.3.0"
78+
if [[ volume-config.%p == $(/usr/bin/docker ps -a | /bin/awk -v pattern='^volume-config.%p$' '$NF ~ pattern { print $NF; }') ]]; then \
79+
/usr/bin/docker run \
80+
--name %p \
81+
-p %i:80 \
82+
-p 8580:8443 \
83+
--env SERVICE_UNIT_INSTANCE=app-1 \
84+
--env SERVICE_UNIT_LOCAL_ID=1 \
85+
--env SERVICE_UNIT_INSTANCE=1 \
86+
--env APACHE_SERVER_NAME=app-1.local \
87+
--env APACHE_SERVER_ALIAS=app-1 \
88+
--env DATE_TIMEZONE=UTC \
89+
--volumes-from volume-config.%p \
90+
-v ${MOUNT_PATH_DATA}/apache-php/app-1:/var/www/app \
91+
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}; \
92+
else \
93+
/usr/bin/docker run \
94+
--name %p \
95+
-p %i:80 \
96+
-p 8580:8443 \
97+
--env SERVICE_UNIT_INSTANCE=app-1 \
98+
--env SERVICE_UNIT_LOCAL_ID=1 \
99+
--env SERVICE_UNIT_INSTANCE=1 \
100+
--env APACHE_SERVER_NAME=app-1.local \
101+
--env APACHE_SERVER_ALIAS=app-1 \
102+
--env DATE_TIMEZONE=UTC \
103+
-v ${MOUNT_PATH_DATA}/apache-php/app-1:/var/www/app \
104+
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}; \
105+
fi"
79106

80107
ExecStartPost=/usr/bin/etcdctl set /services/apache-php/app-1/1.1 %H:%i
81108

build.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22

33
# Change working directory
4-
DIR_PATH="$( if [ "$( echo "${0%/*}" )" != "$( echo "${0}" )" ] ; then cd "$( echo "${0%/*}" )"; fi; pwd )"
5-
if [[ $DIR_PATH == */* ]] && [[ $DIR_PATH != "$( pwd )" ]] ; then
6-
cd $DIR_PATH
4+
DIR_PATH="$( if [[ $( echo "${0%/*}" ) != $( echo "${0}" ) ]]; then cd "$( echo "${0%/*}" )"; fi; pwd )"
5+
if [[ ${DIR_PATH} == */* ]] && [[ ${DIR_PATH} != $( pwd ) ]]; then
6+
cd ${DIR_PATH}
77
fi
88

9-
NO_CACHE="$1"
9+
NO_CACHE=$1
1010

1111
source build.conf
1212

@@ -16,28 +16,27 @@ show_docker_image ()
1616
local NAME_PARTS=(${NAME//:/ })
1717

1818
# Set 'latest' tag if no tag requested
19-
if [ ${#NAME_PARTS[@]} == 1 ]; then
19+
if [[ ${#NAME_PARTS[@]} == 1 ]]; then
2020
NAME_PARTS[1]='latest'
2121
fi
2222

2323
docker images | grep -e "^${NAME_PARTS[0]}[ ]\{1,\}${NAME_PARTS[1]}"
2424
}
2525

26-
echo Building ${DOCKER_IMAGE_REPOSITORY_NAME}...
26+
echo "Building ${DOCKER_IMAGE_REPOSITORY_NAME}"
2727

2828
# Allow cache to be bypassed
29-
if [ "$NO_CACHE" == "true" ]; then
29+
if [[ ${NO_CACHE} == "true" ]]; then
3030
echo " ---> Skipping cache"
3131
else
3232
NO_CACHE="false"
3333
fi
3434

3535
# Build from working directory
36-
docker build --no-cache=$NO_CACHE -t ${DOCKER_IMAGE_REPOSITORY_NAME} .
37-
36+
docker build --no-cache=${NO_CACHE} -t ${DOCKER_IMAGE_REPOSITORY_NAME} .
3837

3938
# Display the last docker image
4039
echo "Docker image:"
4140
show_docker_image ${DOCKER_IMAGE_REPOSITORY_NAME}
4241

43-
echo " ---> Build complete"
42+
echo " ---> Build complete"

etc/apache-bootstrap

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,42 @@ get_password ()
77
echo $(head -n 4096 /dev/urandom | tr -cd '[:alnum:]' | head -c ${1})
88
}
99

10+
APP_HOME_DIR_TEMPLATE="/var/www/.app-skel"
11+
12+
OPTS_APACHE_SERVER_NAME="${APACHE_SERVER_NAME:-$(hostname)}"
13+
OPTS_APACHE_MOD_SSL_ENABLED="${APACHE_MOD_SSL_ENABLED:-false}"
14+
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}"
15+
OPTS_APP_HOME_DIR="${APP_HOME_DIR:-/var/www/app}"
1016
OPTS_SERVICE_USER="${SERVICE_USER:-app}"
1117
OPTS_SERVICE_USER_GROUP="${SERVICE_USER_GROUP:-app-www}"
12-
OPTS_SERVICE_USER_PASSWORD="${SERVICE_USER_PASSWORD:-$(get_password 8)}"
1318
OPTS_SERVICE_USER_GROUP_PASSWORD="${SERVICE_USER_GROUP_PASSWORD:-$(get_password 8)}"
19+
OPTS_SERVICE_USER_PASSWORD="${SERVICE_USER_PASSWORD:-$(get_password 8)}"
1420
OPTS_SUEXECUSERGROUP="${SUEXECUSERGROUP:-false}"
1521

16-
OPTS_APACHE_SERVER_NAME="${APACHE_SERVER_NAME:-$(hostname)}"
17-
OPTS_APACHE_MOD_SSL_ENABLED="${APACHE_MOD_SSL_ENABLED:-false}"
18-
19-
if [[ ! -d ${APP_HOME_DIR} ]] && [[ -d ${APP_HOME_DIR_TEMPLATE} ]]; then
20-
echo Recreate the ${APP_HOME_DIR} directory...
21-
mkdir -p ${APP_HOME_DIR}
22+
if [[ ! -d ${OPTS_APP_HOME_DIR} ]] && [[ -d ${OPTS_APP_HOME_DIR_TEMPLATE} ]]; then
23+
echo "Recreate the ${OPTS_APP_HOME_DIR} directory."
24+
mkdir -p ${OPTS_APP_HOME_DIR}
2225
fi
2326

24-
if [[ ! -n $(find ${APP_HOME_DIR} -maxdepth 1 -type f) ]] && [[ -d ${APP_HOME_DIR_TEMPLATE} ]]; then
25-
echo Home directory ${APP_HOME_DIR} exists but is empty - populate it using ${APP_HOME_DIR_TEMPLATE}...
26-
cp -rf ${APP_HOME_DIR_TEMPLATE}/. ${APP_HOME_DIR}/
27+
if [[ -z $(find ${OPTS_APP_HOME_DIR} -maxdepth 1 -type f) ]] && [[ -d ${APP_HOME_DIR_TEMPLATE} ]]; then
28+
echo "Home directory ${OPTS_APP_HOME_DIR} is empty - populate it using ${APP_HOME_DIR_TEMPLATE}."
29+
cp -rf ${APP_HOME_DIR_TEMPLATE}/. ${OPTS_APP_HOME_DIR}/
2730
fi
2831

2932
# Document root directory is required
30-
if [[ ! -d ${APP_HOME_DIR}/public_html ]]; then
31-
echo ERROR: ${APP_HOME_DIR}/public_html not found.
33+
if [[ ! -d ${OPTS_APP_HOME_DIR}/public_html ]]; then
34+
echo "ERROR: ${OPTS_APP_HOME_DIR}/public_html not found."
3235
exit 1
3336
fi
3437

38+
if [[ ${OPTS_APP_HOME_DIR} != /var/www/app ]]; then
39+
unlink /home/app && ln -s ${OPTS_APP_HOME_DIR} /home/app
40+
fi
41+
3542
# If users need to change the vhost.conf the SSL version can be rebuilt if it is deleted
36-
if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]] && [[ ! -f ${APP_HOME_DIR}/vhost-ssl.conf ]] && [[ -f ${APP_HOME_DIR}/vhost.conf ]]; then
37-
echo Rebuilding the SSL VirtualHost configuration...
38-
cp -pf ${APP_HOME_DIR}/vhost.conf ${APP_HOME_DIR}/vhost-ssl.conf
43+
if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]] && [[ ! -f ${OPTS_APP_HOME_DIR}/vhost-ssl.conf ]] && [[ -f ${OPTS_APP_HOME_DIR}/vhost.conf ]]; then
44+
echo "Rebuilding the SSL VirtualHost configuration."
45+
cp -pf ${OPTS_APP_HOME_DIR}/vhost.conf ${OPTS_APP_HOME_DIR}/vhost-ssl.conf
3946

4047
# Enable the SSL VirtualHosts configuration
4148
sed -i \
@@ -47,70 +54,78 @@ if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]] && [[ ! -f ${APP_HOME_DIR}/vho
4754
-e 's~#SSLCipherSuite \(.*\)$~SSLCipherSuite \1~g' \
4855
-e 's~#SSLCertificateFile \(.*\)$~SSLCertificateFile \1~g' \
4956
-e 's~#SSLCertificateKeyFile \(.*\)$~SSLCertificateKeyFile \1~g' \
50-
${APP_HOME_DIR}/vhost-ssl.conf
57+
${OPTS_APP_HOME_DIR}/vhost-ssl.conf
5158
fi
5259

5360
# Enable/Disable SSL support
54-
if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == "true" ]]; then
55-
echo Enabling SSL support...
61+
if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == true ]]; then
62+
echo "Enabling SSL support."
5663
cat /etc/httpd/conf.d/ssl.conf.off > /etc/httpd/conf.d/ssl.conf
5764

5865
sed -i \
5966
-e 's~^#NameVirtualHost \*:443$~NameVirtualHost \*:443~g' \
60-
-e 's~^#Include ${APP_HOME_DIR}/vhost-ssl.conf$~Include ${APP_HOME_DIR}/vhost-ssl.conf~g' \
67+
-e 's~^#Include ${OPTS_APP_HOME_DIR}/vhost-ssl.conf$~Include ${OPTS_APP_HOME_DIR}/vhost-ssl.conf~g' \
6168
/etc/httpd/conf/httpd.conf
6269

6370
if [[ ! -f /etc/services-config/ssl/private/localhost.key ]] || [[ ! -f /etc/services-config/ssl/certs/localhost.crt ]]; then
64-
echo Generating new certificate...
65-
openssl req -x509 -nodes -newkey rsa:4096 \
66-
-days 365 \
67-
-subj "/C=--/ST=STATE/L=LOCALITY/O=ORGANIZATION/CN=${OPTS_APACHE_SERVER_NAME}" \
68-
-keyout /etc/services-config/ssl/private/localhost.key \
69-
-out /etc/services-config/ssl/certs/localhost.crt
71+
echo "Generating new certificate."
72+
openssl req \
73+
-x509 \
74+
-nodes \
75+
-newkey rsa:4096 \
76+
-days 365 \
77+
-subj "/C=--/ST=STATE/L=LOCALITY/O=ORGANIZATION/CN=${OPTS_APACHE_SERVER_NAME}" \
78+
-keyout /etc/services-config/ssl/private/localhost.key \
79+
-out /etc/services-config/ssl/certs/localhost.crt
7080
fi
7181

7282
openssl x509 -in /etc/services-config/ssl/certs/localhost.crt -text
7383
else
74-
echo Disabling SSL support...
84+
echo "Disabling SSL support."
7585
> /etc/httpd/conf.d/ssl.conf
7686

7787
sed -i \
7888
-e 's~^NameVirtualHost \*:443$~#NameVirtualHost \*:443~g' \
79-
-e 's~^Include ${APP_HOME_DIR}/vhost-ssl.conf$~#Include ${APP_HOME_DIR}/vhost-ssl.conf~g' \
89+
-e 's~^Include ${OPTS_APP_HOME_DIR}/vhost-ssl.conf$~#Include ${OPTS_APP_HOME_DIR}/vhost-ssl.conf~g' \
8090
/etc/httpd/conf/httpd.conf
8191
fi
8292

8393
# Set the service user / service group user
84-
if getent passwd app && [[ ${OPTS_SERVICE_USER} != "app" ]]; then
94+
if getent passwd app && [[ ${OPTS_SERVICE_USER} != app ]]; then
8595
usermod -l ${OPTS_SERVICE_USER} app
8696
fi
8797

88-
if getent passwd app-www && [[ ${OPTS_SERVICE_USER_GROUP} != "app-www" ]]; then
98+
if getent passwd app-www && [[ ${OPTS_SERVICE_USER_GROUP} != app-www ]]; then
8999
usermod -l ${OPTS_SERVICE_USER_GROUP} app-www
90100
fi
91101

92102
# Set the Apache (run) service user/group
93-
if [[ ${OPTS_SUEXECUSERGROUP} == "true" ]]; then
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
103+
if [[ ${OPTS_SUEXECUSERGROUP} == true ]]; then
104+
sed -i \
105+
-e "s~^User .*$~User ${OPTS_SERVICE_USER_GROUP}~g" \
106+
-e "s~^Group .*$~Group ${OPTS_SERVICE_USER_GROUP}~g" \
107+
/etc/httpd/conf/httpd.conf
108+
sed -i \
109+
-e 's~#SuexecUserGroup \(.*\)$~SuexecUserGroup \1~g' \
110+
-e 's~app/bin/php-wrapper~app-bin/php-wrapper~g' \
111+
${OPTS_APP_HOME_DIR}/vhost.conf \
112+
${OPTS_APP_HOME_DIR}/vhost-ssl.conf
98113
chown -R 502:502 /var/{www/app-bin,run/mod_fcgid}
99114
else
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
115+
sed -i \
116+
-e "s~^User .*$~User apache~g" \
117+
-e "s~^Group .*$~Group apache~g" \
118+
/etc/httpd/conf/httpd.conf
119+
sed -i \
120+
-e 's~\([^#]\)SuexecUserGroup \(.*\)$~\1#SuexecUserGroup \2~g' \
121+
-e 's~app/bin/php-wrapper~app-bin/php-wrapper~g' \
122+
${OPTS_APP_HOME_DIR}/vhost.conf \
123+
${OPTS_APP_HOME_DIR}/vhost-ssl.conf
104124
chown -R apache:apache /var/{www/app-bin,run/mod_fcgid}
105125
fi
106126

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-
111-
echo Loading Apache modules...
112-
for MODULE in ${APACHE_LOAD_MODULES}
113-
do
127+
echo "Loading Apache modules."
128+
for MODULE in ${APACHE_LOAD_MODULES}; do
114129
echo " - ${MODULE}"
115130
sed -i \
116131
-e "s~^#LoadModule ${MODULE} ~LoadModule ${MODULE} ~g" \

0 commit comments

Comments
 (0)