升级到 http 2 后出现错误 503

I get error 503 after upgrading to http 2

升级到http 2.0后,总是报错503,谁能帮我解决这个问题?

error.log:

[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>

更新:域error.log

[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

感谢您的帮助!

希望对遇到同样情况的你有用。我需要做的就是:

打开 /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

最后需要重启fpm sudo service php<version>-fpm start

顺便说一句,php-fpm 版本可能与您的php 版本不同。例如,输入 php -v 显示 7.4。但是

 <?php phpinfo();

现在显示 8.0。所以我不得不选择这个目录 /etc/php/8.0/fpm/pool.d