為什麼 apache 只能與 mpm-prefork 一起工作?

為什麼 apache 只能與 mpm-prefork 一起工作?

我在 LAMP 上有 2 個 WordPress 網站(Linux、Apache2、MariaDB 和 PHP-FPM)。

如果我停用 mpm-prefork 並啟用 mpm-worker 或 mpm-event,apache 僅顯示一個空白頁面(我有一些 WordPress 網站)。

奇怪的是日誌沒有提到問題。

我的 Apache 設定如下

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server www.example.com (/etc/httpd24/conf.sh/example-80.conf:1)
         port 80 namevhost www.example.com (/etc/httpd24/conf.sh/example-80.conf:1)
                 alias example.com
         port 80 namevhost www.sub.example.com (/etc/httpd24/conf.sh/sub-80.conf:1)
                 alias sub.example.com
*:443                  is a NameVirtualHost
         default server ip-172-31-0-20.ec2.internal (/etc/httpd24/conf.d/ssl.conf:56)
         port 443 namevhost ip-172-31-0-20.ec2.internal (/etc/httpd24/conf.d/ssl.conf:56)
         port 443 namevhost www.example.com (/etc/httpd24/conf.sh/example.conf:1)
                 alias example.com
         port 443 namevhost www.sub.example.com (/etc/httpd24/conf.sh/sub.conf:1)
                 alias sub.example.com
ServerRoot: "/etc/httpd24"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd24/logs/error_log"
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/etc/httpd24/run/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
PidFile: "/etc/httpd24/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

這是相關模組:

httpd24 -M | egrep  'proxy|http2|event'
 http2_module (shared)
 mpm_event_module (shared)
 proxy_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 proxy_connect_module (shared)
 proxy_express_module (shared)
 proxy_fcgi_module (shared)
 proxy_fdpass_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_hcheck_module (shared)
 proxy_scgi_module (shared)
 proxy_uwsgi_module (shared)
 proxy_wstunnel_module (shared)

軟體包的版本是:

httpd24-httpd-tools-2.4.34-22.el7.x86_64
rh-php73-php-fpm-7.3.20-1.el7.x86_64
httpd24-libnghttp2-1.7.1-8.el7.1.x86_64
httpd24-httpd-2.4.34-22.el7.x86_64
httpd24-mod_ssl-2.4.34-22.el7.x86_64
httpd24-runtime-1.1-19.el7.x86_64
httpd24-1.1-19.el7.x86_64

作業系統是Centos 7:

uname -a ; cat /etc/redhat-release 
Linux ip-172-31-0-20.ec2.internal 3.10.0-1160.21.1.el7.x86_64 #1 SMP Tue Mar 16 18:28:22 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
CentOS Linux release 7.9.2009 (Core)

為什麼會出現這種情況?我該如何修復它?

答案1

嘗試調高 ErrorLog LogLevel 進行調試。

https://httpd.apache.org/docs/2.4/mod/core.html#errorlog

相關內容