升级到 http 2 后出现错误 503
Posted
技术标签:
【中文标题】升级到 http 2 后出现错误 503【英文标题】:I get error 503 after upgrading to http 2 【发布时间】:2021-09-26 20:13:58 【问题描述】:升级到http 2.0后,老是报错503,谁能帮我解决一下?
错误日志:
[Mon Jul 19 11:03:26.351473 2021] [mpm_event:notice] [pid 9022:tid 140512076250176] AH00493: SIGUSR1 received. Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Mon Jul 19 11:03:26.407467 2021] [mpm_event:notice] [pid 9022:tid 140512076250176] AH00489: Apache/2.4.41 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.1.1f configured -- resuming normal operations
[Mon Jul 19 11:03:26.407479 2021] [core:notice] [pid 9022:tid 140512076250176] AH00094: Command line: '/usr/sbin/apache2'
在 /etc/apache2/mods-enabled 我看到 http2.conf
(如果我是对的)
通过 mod_macro 虚拟主机:
<Macro VHost $dir $domain>
<VirtualHost *:443>
Protocols h2 http/1.1
SSLEngine on
SSLCertificateFile /etc/ssl/certs/my.crt
SSLCertificateKeyFile /etc/ssl/private/my.key
AccessFileName .htaccess
DocumentRoot $dir/$domain/httpdocs/
ErrorLog $dir/$domain/error.log
ServerName $domain
ServerAlias www.$domain
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory $dir/$domain>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
</Macro>
更新:域错误日志
[Mon Jul 19 12:47:06.338104 2021] [proxy:error] [pid 18649:tid 140511882213120] (13)Permission denied: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.0-fpm.sock (*) failed
[Mon Jul 19 12:47:06.338133 2021] [proxy_fcgi:error] [pid 18649:tid 140511882213120] [client 127.0.0.1:51542] AH01079: failed to make connection to backend: httpd-UDS
[Mon Jul 19 12:47:06.519092 2021] [proxy:error] [pid 18649:tid 140511882213120] (13)Permission denied: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.0-fpm.sock (*) failed
[Mon Jul 19 12:47:06.519108 2021] [proxy_fcgi:error] [pid 18649:tid 140511882213120] [client 127.0.0.1:51542] AH01079: failed to make connection to backend: httpd-UDS, referer: https://s2019/
[Mon Jul 19 12:47:12.305094 2021] [ssl:warn] [pid 9022:tid 140512076250176] AH01906: s2019:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Mon Jul 19 12:47:12.305103 2021] [ssl:warn] [pid 9022:tid 140512076250176] AH01909: s2019:443:0 server certificate does NOT include an ID which matches the server name
感谢您的帮助!
【问题讨论】:
【参考方案1】:如果你遇到同样的情况,我希望它会有所帮助。我需要做的就是:
打开/etc/php/<version>/fpm/pool.d
并替换值
listen.owner = www-data
listen.group = www-data
/etc/apache2/envvars
中的数据
export APACHE_RUN_USER=someuser
export APACHE_RUN_GROUP=someuser
结果将是:
listen.owner = someuser
listen.group = someuser
最后需要重启fpmsudo service php<version>-fpm start
顺便说一下,php-fpm 版本可能与您的php 版本不同。例如,输入 php -v
会显示 7.4。但是
<?php phpinfo();
现在显示 8.0。所以我不得不选择这个目录/etc/php/8.0/fpm/pool.d
【讨论】:
以上是关于升级到 http 2 后出现错误 503的主要内容,如果未能解决你的问题,请参考以下文章
使用 cPanel 传输工具移动后,旧服务器上出现错误 503(服务不可用)