【问题标题】:Cloudflare SSL Handshake Failed (Error 525)Cloudflare SSL 握手失败(错误 525)
【发布时间】:2017-07-27 08:51:01
【问题描述】:

我的网站(和主机)有问题。 我正在为我的网站使用完整(严格)加密设置。而且我不知道为什么它会遇到错误,因为上个月网络工作正常。

这里是调试

使用 curl -sv -o 命令:

curl -sv -o /dev/null https://<domain>.com/ --resolve <domain>.com:<<port>>:<<ip>>

* Added <domain>.com:<<port>>:<<ip>> to DNS cache
* Hostname <domain>.com was found in DNS cache
*   Trying <<vps_ip>>...
* TCP_NODELAY set
* Connected to <domain>.com (<<vps_ip>>) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /usr/local/etc/openssl/cert.pem
  CApath: /usr/local/etc/openssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
* stopped the pause stream!
* Closing connection 0

使用 openssl s_client 命令:

openssl s_client -connect <<vps_ip>>:443 | openssl x509 -text -noout

52457:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/ssl/s23_clnt.c:618: unable to load certificate

52458:error:0906D06C:PEM routines:PEM_read_bio:no start line:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/pem/pem_lib.c:648:Expecting: TRUSTED CERTIFICATE

这里是 VHost 配置:

Listen 80
<VirtualHost *:80>
    ServerName <domain>
    ServerAlias <alias>
    ServerAdmin -alreadyset-
    DocumentRoot -alreadyset-

    SSLEngine      off
    SSLCertificateFile        -alreadyset-/mikata.pem
    SSLCertificateKeyFile     -alreadyset-/mikata.key

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /home/emtetour/public_html>
        Options Indexes FollowSymLinks Multiviews
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    ErrorLog -alreadyset-
    CustomLog -alreadyset-

</VirtualHost>

Listen 443
<VirtualHost *:443>
    ServerName <domain>
    ServerAlias <alias>
    ServerAdmin -alreadyset-
    DocumentRoot -alreadyset-

    SSLEngine      on
    SSLCertificateFile        -alreadyset-/mikata.pem
    SSLCertificateKeyFile     -alreadyset-/mikata.key

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

    <Directory /<directory>/public_html>
        Options Indexes FollowSymLinks Multiviews
        AllowOverride None
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

</VirtualHost>

有人可以帮助我吗?已经4天了,我不知道要解决什么... 谢谢..

附: 服务器运行 Apache2.4.25 和 UbuntuOS。密码和协议与 cloudflare SSL 兼容。

找到解决方案

这可能是一个很晚的编辑,但显然 Apache 需要为 443 端口设置默认的 VirtualHost。

所以你必须添加 111-default.conf 之类的内容,然后只编写服务器管理员、文档根目录和 SSL 配置(因为我的是野生证书,所以我使用与网站相同的配置)。

希望这对遇到类似问题的其他人有所帮助。

【问题讨论】:

    标签: apache ssl ssl-certificate cloudflare


    【解决方案1】:

    根据您提供的错误消息,您的证书似乎是错误的:

    Expecting: TRUSTED CERTIFICATE
    

    【讨论】:

      【解决方案2】:

      我放了

      <VirtualHost *:443></VirtualHost>
      

      在 000-defaults.conf 中只定义了 DocumentRoot 并得到了同样的错误。 所以去掉之后就完全没问题了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-08-23
        • 1970-01-01
        • 2015-12-21
        • 1970-01-01
        • 2018-07-21
        • 2014-01-14
        • 2012-06-18
        • 1970-01-01
        相关资源
        最近更新 更多