猿问

加载代理模块时,Docker 中的 Apache 2.4 httpd 无法启动

我正在用 Docker 构建一个 Apache2.4 堆栈。在配置期间,服务器没有启动:


apache-php-fpm-docker_apache_1 exited with code 1

在添加以下行加载模块后发现这种情况:


LoadModule proxy_module modules/mod_proxy.so

我认为我做错了什么,但我怎样才能得到错误信息以查看问题所在?


我已经尝试过的

运行httpd -h我看到以下选项:


-e level           : show startup errors of level (see LogLevel)


所以我ENTRYPOINT httpd -k start -e debug现在尝试查看一些日志,但没有看到错误。并且网络服务器不会启动,即使错误已修复。


完整的 apache 配置

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>


POPMUISE
浏览 253回答 1
1回答

翻翻过去那场雪

首先,添加ErrorLog /proc/self/fd/2到您的http.conf以启用错误日志。然后,我看到了你的情况的错误日志:shubuntu1@shubuntu1:~/aa$ docker run -idt -v ${PWD}/httpd.conf:/usr/local/apache2/conf/httpd.conf -p 9000:80 httpd:2.4fd0d0b45bd8e25e5ce8219d6b96e5b446307d7a76bf7e3eecb47e23d93b04368shubuntu1@shubuntu1:~/aa$ docker ps -aCONTAINER ID&nbsp; &nbsp; &nbsp; &nbsp; IMAGE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COMMAND&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATED&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STATUS&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PORTS&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NAMESfd0d0b45bd8e&nbsp; &nbsp; &nbsp; &nbsp; httpd:2.4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"httpd-foreground"&nbsp; &nbsp;3 seconds ago&nbsp; &nbsp; &nbsp; &nbsp;Exited (1) 1 second ago&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;agitated_edisonshubuntu1@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 mutexAH00016: Configuration Failed从错误日志:创建代理互斥体时似乎失败proxy_module。所以,我在旁边添加httpd.conf,然后一切正常:<IfModule unixd_module>User daemonGroup daemon</IfModule>
随时随地看视频慕课网APP
我要回答