Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apache-extras.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@ RUN set -eux; \
a2enconf remoteip; \
# https://github.com/docker-library/wordpress/issues/383#issuecomment-507886512
# (replace all instances of "%h" with "%a" in LogFormat)
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +; \
# apply sensible security defaults: 403 hidden files/dirs + common backup/source filetypes
{ \
echo 'RedirectMatch 403 /\..*$'; \
echo '<FilesMatch "(\.(bak|back|backup|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">'; \
echo 'Require all denied'; \
echo '</FilesMatch>'; \
} > /etc/apache2/conf-available/forbidden.conf; \
a2enconf forbidden
10 changes: 9 additions & 1 deletion php7.2/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ RUN set -eux; \
a2enconf remoteip; \
# https://github.com/docker-library/wordpress/issues/383#issuecomment-507886512
# (replace all instances of "%h" with "%a" in LogFormat)
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +; \
# apply sensible security defaults: 403 hidden files/dirs + common backup/source filetypes
{ \
echo 'RedirectMatch 403 /\..*$'; \
echo '<FilesMatch "(\.(bak|back|backup|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">'; \
echo 'Require all denied'; \
echo '</FilesMatch>'; \
} > /etc/apache2/conf-available/forbidden.conf; \
a2enconf forbidden


ENV WORDPRESS_VERSION 5.5
Expand Down
10 changes: 9 additions & 1 deletion php7.3/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ RUN set -eux; \
a2enconf remoteip; \
# https://github.com/docker-library/wordpress/issues/383#issuecomment-507886512
# (replace all instances of "%h" with "%a" in LogFormat)
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +; \
# apply some sensible security defaults: 403 hidden files/dirs + common backup/source filetypes
{ \
echo 'RedirectMatch 403 /\..*$'; \
echo '<FilesMatch "(\.(bak|back|backup|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">'; \
echo 'Require all denied'; \
echo '</FilesMatch>'; \
} > /etc/apache2/conf-available/forbidden.conf; \
a2enconf forbidden


ENV WORDPRESS_VERSION 5.5
Expand Down
10 changes: 9 additions & 1 deletion php7.4/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ RUN set -eux; \
a2enconf remoteip; \
# https://github.com/docker-library/wordpress/issues/383#issuecomment-507886512
# (replace all instances of "%h" with "%a" in LogFormat)
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +
find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' +; \
# apply sensible security defaults: 403 hidden files/dirs + common backup/source filetypes
{ \
echo 'RedirectMatch 403 /\..*$'; \
echo '<FilesMatch "(\.(bak|back|backup|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">'; \
echo 'Require all denied'; \
echo '</FilesMatch>'; \
} > /etc/apache2/conf-available/forbidden.conf; \
a2enconf forbidden


ENV WORDPRESS_VERSION 5.5
Expand Down