Files
files/webserver.Dockerfile
2026-01-12 19:52:02 +01:00

52 lines
1.7 KiB
Docker

FROM httpd:2.4
# Enable modules
RUN sed -i \
-e 's/^#LoadModule rewrite_module/LoadModule rewrite_module/' \
-e 's/^#LoadModule headers_module/LoadModule headers_module/' \
-e 's/^#LoadModule autoindex_module/LoadModule autoindex_module/' \
-e 's/^#LoadModule alias_module/LoadModule alias_module/' \
/usr/local/apache2/conf/httpd.conf
# Add custom autoindex CSS (served from /icons/)
RUN printf '%s\n' \
'/* Widen "Name" column in Apache autoindex */' \
'table#indexlist td.indexcolname, table#indexlist th.indexcolname {' \
' width: 60ch;' \
' max-width: 60ch;' \
'}' \
'table#indexlist td.indexcolname a {' \
' display: inline-block;' \
' max-width: 60ch;' \
'}' \
> /usr/local/apache2/icons/autoindex-custom.css
# Configure autoindex + icons + .htaccess + ignore "_" entries + UTF-8
RUN printf '\n# --- Custom for file listing + .htaccess ---\n\
AddDefaultCharset UTF-8\n\
\n\
Include conf/extra/httpd-autoindex.conf\n\
\n\
Alias /icons/ "/usr/local/apache2/icons/"\n\
<Directory "/usr/local/apache2/icons">\n\
Require all granted\n\
</Directory>\n\
\n\
# Inject CSS for directory listings\n\
IndexHeadInsert "<link rel=\\"stylesheet\\" href=\\"/icons/autoindex-custom.css\\" type=\\"text/css\\">"\n\
\n\
<Directory "/usr/local/apache2/htdocs">\n\
Options Indexes FollowSymLinks\n\
IndexIgnore _*\n\
AllowOverride All\n\
Require all granted\n\
</Directory>\n' >> /usr/local/apache2/conf/httpd.conf
# Force download for shared files
RUN printf '\n# --- Force download in _share ---\n\
<Directory "/usr/local/apache2/htdocs/_share">\n\
Header set Content-Disposition "attachment"\n\
</Directory>\n' >> /usr/local/apache2/conf/httpd.conf
EXPOSE 80