SetHandler“ proxy:unix:/run/php/php5.6-fpm.sock | fcgi:// localhost /” ON <虚拟主机*:443 =“”>

时间:2018-07-28 12:56:15

标签: php apache configuration virtualhost

我在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>

提前谢谢

1 个答案:

答案 0 :(得分:0)

我发现 因为我有几个处理virtualhost的文件,这就是为什么。 我有一个文件 /etc/apache2/sites-available/default-ssl.conf ,该文件可以处理一些虚拟主机443 非常感谢您的支持