Docker Apache installation fails

I am trying to start apache service with docker-compose up, but I get this error:

apache_1  | AH00526: Syntax error on line 15 of /usr/local/apache2/conf/httpd.conf:
apache_1  | Invalid command 'DirectoryIndex', perhaps misspelled or defined by a module not included in the server configuration

This is my Dockerfile for httpd:

FROM httpd:2.4
COPY ./httpd.conf /usr/local/apache2/conf/httpd.conf

This is my httpd.conf file:

ServerName localhost

LoadModule deflate_module /usr/local/apache2/modules/mod_deflate.so
LoadModule proxy_module /usr/local/apache2/modules/mod_proxy.so
LoadModule proxy_fcgi_module /usr/local/apache2/modules/mod_proxy_fcgi.so

LoadModule mpm_event_module /usr/local/apache2/modules/mod_mpm_event.so
#LoadModule mpm_prefork_module /usr/local/apache2/modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module /usr/local/apache2/modules/mod_mpm_worker.so

<VirtualHost *:80>

DocumentRoot /var/www/html/
<Directory /var/www/html/>
    DirectoryIndex index.html
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

# Send apache logs to stdout and stderr
CustomLog /proc/self/fd/1 common
ErrorLog /proc/self/fd/2
</VirtualHost>

1 answer

  • answered 2018-10-11 19:29 maxm

    I think you need to make sure you load the mod_dir module

    LoadModule dir_module libexec/apache2/mod_dir.so