设置处理程序 "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost/" 打开 <VirtualHost *:443>

SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost/" ON <VirtualHost *:443>

我在 apache2 下有一个服务器有多个 php 版本。 我可以使用代理但不能用于 我放

<FilesMatch \ .php $>
    # Apache 2.4.10+ can proxy to unix socket
    SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost/"
</ FilesMatch>

为什么它在 443 上不起作用?

我的例子:

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerAdmin email@example.com
        ServerName example.com
        DocumentRoot /var/www/html/
        <Directory /var/www/html/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
        <FilesMatch \.php$>
            # Apache 2.4.10+ can proxy to unix socket
            SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost/"
        </FilesMatch>
        SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
    </VirtualHost>
</IfModule>

我的 VirtualHost *:80(有效)

<VirtualHost *:80>
    ServerAdmin email@example.com
    ServerName example.com
    DocumentRoot /var/www/html/
    <Directory /var/www/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    <FilesMatch \.php$>
        # Apache 2.4.10+ can proxy to unix socket
        SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost/"
    </FilesMatch>
</VirtualHost>

提前致谢

我找到了 因为我有几个处理虚拟主机的文件,这就是原因。 我有一个文件 /etc/apache2/sites-available/default-ssl.conf 负责一些虚拟主机 443 非常感谢您的支持