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

Commit 54cdd01

Browse files
authored
Merge pull request #263 from jdeathe/issue/251
CLOSES #251: Fixes default Apache DirectoryIndex file.
2 parents aef8c67 + cc66a45 commit 54cdd01

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Summary of release changes.
1919
- Adds `/docs` directory for supplementary documentation and simplify README.
2020
- Adds drop-in configuration for `/server-satus`; removes from global Apache configuration.
2121
- Fixes validation failure of 0 second --timeout value in `test/health_status`.
22+
- Fixes unintentional override of default `DirectoryIndex` in main Apache configuration.
2223

2324
### 1.13.2 - 2019-08-05
2425

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ADD src /
4444
# - Limit threads for the application user
4545
# - Disable Apache directory indexes and welcome page
4646
# - Disable Apache language based content negotiation
47+
# - Prevent unintentional override of default DirectoryIndex
4748
# - Custom Apache configuration
4849
# - Disable all Apache modules and enable the minimum
4950
# - Disable Apache default fcgid configuration; replaced with 00-fcgid.conf
@@ -89,6 +90,7 @@ RUN useradd -r -M -d /var/www/app -s /sbin/nologin app \
8990
-e 's~^LanguagePriority \(.*\)$~#LanguagePriority \1~g' \
9091
-e 's~^ForceLanguagePriority \(.*\)$~#ForceLanguagePriority \1~g' \
9192
-e 's~^AddLanguage \(.*\)$~#AddLanguage \1~g' \
93+
-e '/^Include conf.d\/\*.conf/i DirectoryIndex index.html index.html.var' \
9294
/etc/httpd/conf/httpd.conf \
9395
&& { printf -- \
9496
'\n%s\n%s\n%s\n%s\\\n%s%s\\\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>{{TITLE}}</title>
5+
</head>
6+
<body>
7+
{{BODY}}
8+
</body>
9+
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>{{TITLE}}</title>
5+
<meta name="php_version" content="<?php echo PHP_VERSION ?>">
6+
</head>
7+
<body>
8+
{{BODY}}
9+
</body>
10+
</html>

test/shpec/operation_shpec.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ function test_basic_operations ()
180180
- setenvif_module
181181
- status_module
182182
- version_module"
183+
local -r content_index_html="$(< test/fixture/apache/var/www/public_html/index.html)"
183184
local -r required_apache_modules="
184185
authz_user_module
185186
log_config_module
@@ -656,6 +657,48 @@ ${other_required_apache_modules}
656657
end
657658
end
658659

660+
describe "Apache DirectoryIndex"
661+
it "Defaults to index.html"
662+
__terminate_container \
663+
apache-php.1 \
664+
&> /dev/null
665+
666+
docker run \
667+
--detach \
668+
--no-healthcheck \
669+
--name apache-php.1 \
670+
--publish ${DOCKER_PORT_MAP_TCP_80}:80 \
671+
--volume ${PWD}/test/fixture/apache/var/www/public_html:/opt/app/public_html:ro \
672+
jdeathe/centos-ssh-apache-php-fcgi:latest \
673+
&> /dev/null
674+
675+
if ! __is_container_ready \
676+
apache-php.1 \
677+
${STARTUP_TIME} \
678+
"/usr/sbin/httpd(\.worker|\.event)? " \
679+
"[[ 000 != \$(curl -sI -o /dev/null -w %{http_code} localhost/) ]]"
680+
then
681+
exit 1
682+
fi
683+
684+
container_hostname="$(
685+
docker exec \
686+
apache-php.1 \
687+
hostname
688+
)"
689+
690+
curl_get_request="$(
691+
curl -s \
692+
--header "Host: ${container_hostname}" \
693+
http://127.0.0.1:${container_port_80}/
694+
)"
695+
696+
assert equal \
697+
"${curl_get_request}" \
698+
"${content_index_html}"
699+
end
700+
end
701+
659702
__terminate_container \
660703
apache-php.1 \
661704
&> /dev/null

0 commit comments

Comments
 (0)