# Apache HTTP Server — static files configuration
# Generated by RDT (Rambo Docker Tools)
# To customise, edit this file and run `rdt add apache-static` again (existing files are not overwritten).

ServerRoot "/usr/local/apache2"
Listen 80

# Core modules
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule mime_module       modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule headers_module    modules/mod_headers.so
LoadModule dir_module        modules/mod_dir.so
LoadModule alias_module      modules/mod_alias.so
LoadModule deflate_module    modules/mod_deflate.so
LoadModule filter_module     modules/mod_filter.so
LoadModule unixd_module      modules/mod_unixd.so

ServerName {{ apache_server_name | default('localhost') }}
ServerAdmin webmaster@localhost

User daemon
Group daemon

# Logging
ErrorLog /proc/self/fd/2
CustomLog /proc/self/fd/1 combined
LogLevel warn

# MIME types
TypesConfig conf/mime.types
AddType application/javascript .js
AddType text/css .css

# Gzip compression
AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/json

<Directory />
    AllowOverride None
    Require all denied
</Directory>

DocumentRoot "/usr/local/apache2/htdocs"

<Directory "/usr/local/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

    DirectoryIndex index.html index.htm

    # Cache static assets
    <FilesMatch "\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$">
        Header set Cache-Control "max-age=31536000, public, immutable"
    </FilesMatch>
</Directory>

