Skip to content

Commit 5104dcb

Browse files
committed
Make it work as a standalone server
1 parent 5236311 commit 5104dcb

3 files changed

Lines changed: 83 additions & 3 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LABEL \
1313
image="apache-2.4" \
1414
vendor="cytopia" \
1515
license="MIT" \
16-
build-date="2016-10-11"
16+
build-date="2016-10-19"
1717

1818

1919
# Copy scripts

scripts/docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
###
66
DEBUG_COMMANDS=0
77

8+
HTTPD_CONF="/etc/httpd/conf/httpd.conf"
89

910

1011
###
@@ -176,7 +177,6 @@ fi
176177

177178

178179

179-
180180
###
181181
### Add new Apache configuration dir
182182
###
@@ -185,7 +185,7 @@ if ! set | grep '^CUSTOM_HTTPD_CONF_DIR=' >/dev/null 2>&1; then
185185
else
186186
# Tell apache to also look into this custom dir for configuratoin
187187
log "info" "Adding custom include directory: ${CUSTOM_HTTPD_CONF_DIR}"
188-
runsu "echo 'IncludeOptional ${CUSTOM_HTTPD_CONF_DIR}/*.conf' >> /etc/httpd/conf/httpd.conf"
188+
runsu "sed -i'' 's|^IncludeOptional[[:space:]]*conf\.d/.*$|IncludeOptional ${CUSTOM_HTTPD_CONF_DIR}/*.conf|g' ${HTTPD_CONF}"
189189
fi
190190

191191

scripts/docker-install.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,86 @@ run "sed -i'' 's/^Group[[:space:]]*=.*$/Group = ${MY_GROUP}/g' ${HTTPD_CONF}"
111111
run "sed -i'' 's/^Listen[[:space:]].*$/Listen 0.0.0.0:80/g' ${HTTPD_CONF}"
112112
run "sed -i'' 's/^#ServerName[[:space:]].*$/ServerName localhost:80/g' ${HTTPD_CONF}"
113113

114+
# Add Custom http Configuration
115+
{
116+
echo "CustomLog \"/var/log/httpd/access_log\" combined";
117+
echo "ErrorLog \"/var/log/httpd/error_log\"";
118+
echo "LogLevel warn";
119+
echo;
120+
121+
echo "AddDefaultCharset UTF-8";
122+
echo;
123+
124+
echo "HostnameLookups Off";
125+
echo;
126+
127+
echo "Timeout 60";
128+
echo "KeepAlive On";
129+
echo "KeepAliveTimeout 10";
130+
echo "MaxKeepAliveRequests 100";
131+
echo;
132+
133+
echo "EnableMMAP Off";
134+
echo "EnableSendfile Off";
135+
echo;
136+
137+
echo "XSendFile On";
138+
echo "XSendFilePath /var/www/html";
139+
echo;
140+
141+
} > "/etc/httpd/conf.d/http-defaults.conf"
142+
143+
144+
# Add Default vhost Configuration
145+
{
146+
echo "<VirtualHost _default_:80>";
147+
echo " ServerName localhost";
148+
echo " ServerAdmin root@localhost";
149+
echo;
150+
151+
echo " ErrorLog /var/log/httpd/localhost-error.log";
152+
echo " CustomLog /var/log/httpd/localhost-access.log combined";
153+
echo;
154+
155+
echo " DirectoryIndex index.html index.htm index.php";
156+
echo;
157+
158+
echo " DocumentRoot \"/var/www/html\"";
159+
echo;
160+
161+
echo " <Directory \"/var/www/html\">";
162+
echo " DirectoryIndex index.html index.htm index.php";
163+
echo;
164+
165+
echo " AllowOverride All";
166+
echo " Options All";
167+
echo;
168+
169+
echo " RewriteEngine on";
170+
echo " RewriteBase /";
171+
echo;
172+
173+
echo " Order allow,deny";
174+
echo " Allow from all";
175+
echo " Require all granted";
176+
echo " </Directory>";
177+
echo "</VirtualHost>";
178+
echo;
179+
180+
} > "/etc/httpd/conf.d/localhost.conf"
181+
182+
183+
184+
# Add test Page
185+
if [ ! -d "/var/www/html" ]; then
186+
run "mkdir -p /var/www/html"
187+
else
188+
run "rm -rf /var/www/html/*"
189+
fi
190+
run "echo '<?php phpversion(); ?>' > /var/www/html/index.php"
191+
run "echo 'It works' > /var/www/html/index.html"
192+
run "chown -R ${MY_USER}:${MY_GROUP} /var/www/html"
193+
114194

115195

116196
###

0 commit comments

Comments
 (0)