apache - SSLRequire 文件表达式

标签 apache mod-ssl

我在 Apache 2.4 中遇到 SSLRequire 文件表达式的问题,因为它似乎无法找到或无法访问有问题的文件。

这是代码摘录:

<Location />    
                SSLOptions +StrictRequire
                SSLRequireSSL
                SSLRequire (%{SSL_CLIENT_CERT} eq file("<full_path_to_PEM_file>"))
</Location>

当我尝试访问该站点时,我在日志中收到此错误:

[Tue Jun 27 13:20:02.358478 2017] [ssl:error] [pid 18661:tid 47040594310912] [client 82.69.3.205:58275] Evaluation of expression from 20-mod_ssl.conf:240 failed: Cannot open file <full_path_to_PEM_file>, referer: https://example.com/

权限是正确的,文件确实存在,所以我不确定在这里还能做什么。

PEM 文件是一个有效的公共(public)证书,在开始和结束时有“BEGIN CERTIFICATE”和“END CERTIFICATE”行...

有什么想法吗?

最佳答案

您的 VHost 应如下所示:

<VirtualHost *:443>
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html/example

    ServerName example.com

    SSLEngine on

    SSLCertificateFile /etc/ssl/CA/example_com.crt
    SSLCertificateKeyFile /etc/ssl/CA/example.key

    # https://support.comodo.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=1203&nav=0,96,1,95
    SSLCertificateChainFile /etc/ssl/CA/chain_example_with_Positive.pem

    SSLHonorCipherOrder On
    SSLProtocol -all +TLSv1 +SSLv3
    SSLCipherSuite RC4-SHA:HIGH:!MD5:!aNULL:!EDH:!ADH
    SSLInsecureRenegotiation off

    <Directory /example/>
            Options Indexes SymLinksIfOwnerMatch
            AllowOverride All
            Require all granted
    </Directory>
    <Directory /var/www/html/example/>
            Options Indexes SymLinksIfOwnerMatch
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown    
</VirtualHost>

关于apache - SSLRequire 文件表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44787239/

相关文章:

eclipse - Apache Tomcat v8 未在 Eclipse Juno 中显示

apache - htaccess 重复重命名 php 文件

php - 配置 PHP 以使用 MySQL 和 phpMyAdmin

php - CORS/访问控制允许来源

apache - 是否可以忽略 Apache 代理证书

php - 如何解决错误 : Need OpenSSL support for https://requests?

Apache https 重定向导致 400 错误

apache - 无法加载 'C:/Apache/Perl/site/lib/auto/Apache2/ModSSL/ModSSL.dll'

php - 本地服务器识别但在线服务器不识别的 HTTP 请求 header