php7.4-fpmはnginx / 1.21.3では動作しません。

php7.4-fpmはnginx / 1.21.3では動作しません。

手動でコンパイルされた実験設定があります。nginx/1.21.3w http3+は高速です。

また、実験をうまく編集しました。カールw http3の実装:

root@domac:~# curl --version
curl 7.80.0-DEV (x86_64-pc-linux-gnu) libcurl/7.80.0-DEV OpenSSL/1.1.1k zlib/1.2.11 ngtcp2/0.1.0-DEV nghttp3/0.1.0-DEV
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS HTTP3 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets
root@domac:~#

しかし、ダウンロードするときhttps://domac.alu.hr:8443/test.php、私はこれを受け取ります:

mtodorov@domac:~$ curl --http3 https://domac.alu.hr:8443/test.php
<?php var_export($_SERVER)?>
mtodorov@domac:~$

私のNginxは次のようになります

root@domac:~# nginx -V
nginx version: nginx/1.21.3 (nginx-quic)
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1 (compatible; BoringSSL) (running with BoringSSL)
TLS SNI support enabled
configure arguments: --build=nginx-quic --with-debug --add-module=../njs/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/run/lock/subsys/nginx --user=www-data --group=www-data --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-http_v3_module --with-http_quic_module --with-stream_quic_module --with-cc-opt=-I../boringssl/include --with-ld-opt='-L../boringssl/build/ssl -L../boringssl/build/crypto'
root@domac:~#

私の/etc/nginx/nginx.confは次のようになります。

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
error_log  /var/log/nginx/error.log  info;
pid        /var/run/nginx/nginx.pid;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    index         index.php index.html index.htm;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8080;
        server_name  domac.alu.hr;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root   /srv/www/nginx;

        location / {
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ [^/]\.php(/|$) {
            # root           /srv/www/nginx;
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            # if (!-f $document_root$fastcgi_script_name) {
                # return 404;
            # }

            fastcgi_pass   unix:/var/run/php/php7.3-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  HTTP_PROXY "";
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny  all;
        }
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #

      server {
            listen 8443 ssl;              # TCP listener for HTTP/1.1
            listen 8443 http3 reuseport;  # UDP listener for QUIC+HTTP/3

            ssl_protocols       TLSv1.3; # QUIC requires TLS 1.3
            ssl_certificate     certs/domac_alu_hr_20201111.pem;
            ssl_certificate_key certs/private/domac_alu_hr_20201111.key;

            add_header Alt-Svc 'h3=":8443"';   # Advertise that HTTP/3 is available
            add_header QUIC-Status $quic;     # Sent when QUIC was used

            root   /srv/www/nginx;

            location / {
            }

            access_log  /var/log/nginx/access-ssl.log  main;
            error_log   /var/log/nginx/error-ssl.log   info;
      }

    # server {
    #     listen       8443 ssl http3 quic;
    #     server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    # }

}

問題はphp7.4-fpmが呼び出されていないようですが、nginxがジョブの結果ではなくtest.phpファイルをそのまま表示するということですか?

同じサーバーにphp7.4-fpmとHTTP / 2でうまく機能するapache2デーモンがありますが、私が知っている限り、現在apache2ではサポートされていないHTTP / 3を実装したいと思います(10月1日)。 、2021)HTTP / 3。

ありがとうございます。マスターstrace -p <proc>nginx procも試してみましたが、開こうとしないようです。/var/run/php/php7.4-fpm.sock...

私はこれが実験的なビルドであることを知っていますが、うまくいきたいと思います。 fastcgiサポートがコンパイルされた可能性があると思いましたが、./configureオプションがオンになっていませんでした。

私が間違っていることを知っていますか?

ベストアンサー1

ポート8443(アクセスされるポート)でリッスンするサーバーブロックには、設定されたPHPハンドラはありません。明らかにスクリプトを処理するには、PHP-FPMに追加する必要があります。

location ~ [^/]\.php(/|$) { .. }内部コピーするには、ポート8443を使用してください。server { }

おすすめ記事