I'm building a Apache2.4 stack with Docker. During configuration, the server doesn't start:
apache-php-fpm-docker_apache_1 exited with code 1
Found out this happens after adding the following line to load a module:
LoadModule proxy_module modules/mod_proxy.so
I think that I did something wrong, but how can I get the error message to see what's the problem?
Running httpd -h
I saw the following option:
-e level : show startup errors of level (see LogLevel)
So I tried ENTRYPOINT httpd -k start -e debug
and see now some logs, but not errors. And the webserver doesn't start, not even when the errors were fixed.
Listen 80
ServerRoot "/usr/local/apache2"
DocumentRoot "/usr/local/apache2/htdocs"
ServerName localhost
LogLevel warn
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<Directory />
AllowOverride none
Require all denied
</Directory>
<Files ".ht*">
Require all denied
</Files>
#ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://php:9000/usr/local/apache2/htdocs/$1
<Directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymlinks
AllowOverride None
Require all granted
</Directory>
version: "2.4"
services:
apache:
image: httpd:2.4
volumes:
- ./apache/httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./src:/usr/local/apache2/htdocs
ports:
- 80:80
php:
image: php:7.3-fpm
volumes_from:
- apache
First, add ErrorLog /proc/self/fd/2
to your http.conf
to enable the error log.
Then, I saw the error log of your situation:
shubuntu1@shubuntu1:~/aa$ docker run -idt -v ${PWD}/httpd.conf:/usr/local/apache2/conf/httpd.conf -p 9000:80 httpd:2.4
fd0d0b45bd8e25e5ce8219d6b96e5b446307d7a76bf7e3eecb47e23d93b04368
shubuntu1@shubuntu1:~/aa$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fd0d0b45bd8e httpd:2.4 "httpd-foreground" 3 seconds ago Exited (1) 1 second ago agitated_edison
shubuntu1@shubuntu1:~/aa$ docker logs agitated_edison
[Wed Jun 19 08:45:20.774433 2019] [core:emerg] [pid 1:tid 139720185319488] (22)Invalid argument: AH00024: Couldn't set permissions on the proxy mutex; check User and Group directives
[Wed Jun 19 08:45:20.774495 2019] [proxy:crit] [pid 1:tid 139720185319488] (22)Invalid argument: AH02478: failed to create proxy mutex
AH00016: Configuration Failed
From the error log: it seems failure when create proxy mutex for proxy_module
. So, I add next to httpd.conf
, then everything works:
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>