Ubuntu 23.04 升级导致 Apache2 超时且无法在两台服务器上提供页面

Ubuntu 23.04 升级导致 Apache2 超时且无法在两台服务器上提供页面

我将 Ubuntu Server 从 22.10 升级到 23.04,它通过 Apache2 托管一些网站以及一些正常运行的 .NET 网站,但升级后,所有 Apache2 网站的请求都超时,其中 WordPress 网站显示 504 网关超时错误,.NET 网站确实加载,但过了一会儿也停止响应。重新启动 Apache2 对 Apache2 网站没有影响,但确实能让 Net 网站短暂地恢复工作。

我设置了一个新的空白 23.04 Ubuntu 实例(从 Ubuntu 网站下载 iso),安装了 Apache2、MariaDB 和 .NET 7,并将所有内容移过去,但在配置 Apache 之后,它的行为与旧服务器完全相同,所以它必须与配置方式有关,尽管这种情况已经一年多没有改变,只应用了更新。

旧服务器作为 VPS 托管在 DigitalOcean 上,而新服务器则通过 TalkTalk 业务连接托管在 Windows Server 上的 Hyper-V 上,该连接已经成功托管了 Postfix 邮件服务器。

我很感激任何关于这方面的想法。我尝试了一些步骤,例如禁用 http2 连接回到 http1.1,还禁用我添加的重写规则以将 http 流量定向到 https,但我所做的一切都没有任何变化,旧服务器已经运行良好一年多了。

这是来自 error.log 的一个片段:

[Fri May 12 06:58:23.885767 2023] [proxy_fcgi:error] [pid 99667:tid 140182967776960] (70007)The timeout specified has expired: [client 198.204.231.122:50058] AH01075: Error dispatching request to : (polling)
[Fri May 12 07:01:03.251102 2023] [proxy_fcgi:error] [pid 99668:tid 140183328556736] (70007)The timeout specified has expired: [remote 10.10.1.1:52874] AH01075: Error dispatching request to : (polling)
[Fri May 12 07:01:08.525998 2023] [proxy_fcgi:error] [pid 99667:tid 140183126714048] (70007)The timeout specified has expired: [client 198.204.231.122:50156] AH01075: Error dispatching request to : (polling)
[Fri May 12 07:09:02.501388 2023] [proxy_fcgi:error] [pid 99668:tid 140182581909184] (70007)The timeout specified has expired: [client 198.204.231.122:50354] AH01075: Error dispatching request to : (polling)
[Fri May 12 07:11:45.345774 2023] [proxy_fcgi:error] [pid 99874:tid 140182288328384] (70007)The timeout specified has expired: [client 198.204.231.122:50451] AH01075: Error dispatching request to : (polling)
[Fri May 12 07:17:07.597795 2023] [proxy_fcgi:error] [pid 99668:tid 140182892308160] (70007)The timeout specified has expired: [client 198.204.231.122:50702] AH01075: Error dispatching request to : (polling)
[Fri May 12 07:17:09.431865 2023] [proxy_fcgi:error] [pid 99667:tid 140182883849920] (70007)The timeout specified has expired: [client 198.204.231.122:50801] AH01075: Error dispatching request to : (polling)
[Fri May 12 08:05:05.369726 2023] [proxy_fcgi:error] [pid 99667:tid 140182909028032] (70007)The timeout specified has expired: [client 52.167.144.160:47424] AH01075: Error dispatching request to : (polling)
[Fri May 12 08:05:09.001276 2023] [proxy_fcgi:error] [pid 99874:tid 140182288328384] (70007)The timeout specified has expired: [client 66.249.73.196:62107] AH01075: Error dispatching request to : (polling)
[Fri May 12 08:50:36.883724 2023] [proxy_fcgi:error] [pid 99667:tid 140182959384256] (70007)The timeout specified has expired: [client 66.249.76.190:49970] AH01075: Error dispatching request to : (polling)
[Fri May 12 09:11:55.907282 2023] [proxy_fcgi:error] [pid 99874:tid 140182254757568] (70007)The timeout specified has expired: [client 66.249.76.65:57755] AH01075: Error dispatching request to : (polling)
[Fri May 12 09:14:36.037940 2023] [proxy_fcgi:error] [pid 100060:tid 140182632265408] (70007)The timeout specified has expired: [client 194.38.21.214:60500] AH01075: Error dispatching request to : (polling)

这是访问日志的一个片段:

194.38.21.214 - - [12/May/2023:08:26:35 +0000] "GET /admin/elfinder/php/connector.minimal.php HTTP/1.1" 302 609 "-" "ALittle Client"
157.55.39.224 - - [12/May/2023:07:38:37 +0000] "GET /courthouse/86/9826/1110397 HTTP/2.0" 200 0 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/103.0.5060.134 Safari/537.36"
157.55.39.224 - - [12/May/2023:07:38:37 +0000] "GET /courthouse/86/9826/1110397 HTTP/2.0" 500 0 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/103.0.5060.134 Safari/537.36"
52.167.144.162 - - [12/May/2023:07:43:49 +0000] "GET /frayproof=39571&bRVjuhw=853552 HTTP/2.0" 200 0 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/103.0.5060.134 Safari/537.36"
52.167.144.162 - - [12/May/2023:07:43:49 +0000] "GET /frayproof=39571&bRVjuhw=853552 HTTP/2.0" 500 0 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/103.0.5060.134 Safari/537.36"
114.119.139.205 - - [12/May/2023:08:39:55 +0000] "GET /ebay/QL320?C=N%3BO%3DD HTTP/1.1" 302 585 "https://www.rwsbetas.com/ebay/QL320?C=M%3BO%3DA" "Mozilla/5.0 (Linux; Android 7.0;) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; PetalBot;+https://webmaster.petalsearch.com/site/petalbot)"
66.249.76.190 - - [12/May/2023:08:02:28 +0000] "GET /s/W2204874 HTTP/1.1" 504 4912 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
114.119.152.221 - - [12/May/2023:08:56:01 +0000] "GET /WiiKey/ HTTP/1.1" 302 555 "https://www.rwsbetas.com" "Mozilla/5.0 (Linux; Android 7.0;) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; PetalBot;+https://webmaster.petalsearch.com/site/petalbot)"
66.249.76.65 - - [12/May/2023:08:23:51 +0000] "GET /s/A400738 HTTP/1.1" 504 4916 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.142 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
54.153.87.12 - - [12/May/2023:09:14:29 +0000] "GET /geeta HTTP/1.1" 301 4905 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
194.38.21.214 - - [12/May/2023:08:29:08 +0000] "GET /admin/elfinder/php/connector.minimal.php HTTP/1.1" 504 4929 "-" "ALittle Client"
10.10.1.1 - - [12/May/2023:09:25:50 +0000] "GET / HTTP/1.1" 302 541 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.0.0"

因此,看起来请求在由 PHP 快速 CGI 模块处理时只是超时了

Error dispatching request to : (polling)

配置apache2的步骤如下:

已安装的软件包:

apache2, php, php-curl, php-mbstring, php-imagick, php-intl

启用 Apache2 模块:

suexec, authz_groupfile, headers, ssl, rewrite, proxy_http

启用 PHP 模块:

mbstring

PHP.ini 更改:

upload_max_filesize = 32M
post_max_size = 32M
date.timezone = Europe/London

最后我切换到了 HTTP2

sudo a2enmod http2
sudo apt install php-fpm
sudo a2dismod php8.1
sudo a2enconf php8.1-fpm
sudo a2enmod proxy_fcgi setenvif
sudo a2dismod php8.1

sudo a2dismod mpm_prefork
sudo a2enmod mpm_event

所以看起来

多于

似乎是 proxy_fcgi 模块导致了这个问题。我会尝试恢复到旧版本。

谢谢罗宾

相关内容