【问题标题】:Apache SSL received a record that exceeded the maximum permissible lengthApache SSL 收到超过最大允许长度的记录
【发布时间】:2012-04-07 02:34:44
【问题描述】:

运行 https 请求时出现错误:

SSL 收到一条超过最大允许长度的记录。
(错误代码:ssl_error_rx_record_too_long)

我在装有 Apache 2.x 的 Windows 7 机器上运行它,我的 Apache 设置 vhost 是:

<VirtualHost *:80>  
    ServerName repocenter.com  
    ServerAlias www.repocenter.com  
    ServerAdmin root@repocenter.com  
    <Proxy *>  
        Order allow,deny  
        Allow from all  
    </Proxy>  
    ProxyPreserveHost On  
    ProxyPass / http://192.168.210.1:9991/  
    ProxyPassReverse / http://192.168.210.1:9991/  
    SetEnvIf X-Url-Scheme https HTTPS=1  
    CustomLog logs/repocenter.com-access.log common  
    ErrorLog logs/repocenter.com-error.log  
</VirtualHost>  

<VirtualHost _default_:443>   
    ServerName repocenter.com:443  
    ServerAlias www.repocenter.com:443   
    ServerAdmin root@repocenter.com       
    <Proxy *>  
        Order allow,deny  
        Allow from all  
    </Proxy>  
    ProxyPreserveHost On  
    ProxyPass / http://192.168.210.1:9991/  
    ProxyPassReverse / http://192.168.210.1:9991/  
    SetEnvIf X-Url-Scheme https HTTPS=1     
</VirtualHost>  

这是一个语法错误,我该如何纠正它?

【问题讨论】:

    标签: apache


    【解决方案1】:

    这通常意味着您正在向 HTTP 服务发送 HTTPS 请求。该消息来自浏览器,抱怨它无法完成预期的 SSL 握手。语法正确,否则 HTTPD 将无法完成重新启动 httpd 服务。

    【讨论】:

    • 哇,这让我很烦,我所要做的就是更改协议。
    【解决方案2】:
    1. 文件/conf/extra/httpd-ssl.conf 配置了正确的 SSL 信息,但由于 httpd.conf 没有加载它而没有被加载。

      要修复此错误,请取消注释以下行(删除 #)。然后重启 Apache。

      #Include conf/extra/httpd-ssl.conf
      
    2. Apache 未设置为侦听端口 443 以获取安全流量。要解决此问题,请在加载 &lt;VirtualHost&gt; 块之前添加以下行:

      Listen 443
      

      如果您使用的是 IPv6,则需要包括 IP 地址和端口:

      Listen 192.168.0.1:443
      
    3. 如果您在非标准端口上运行 HTTPS,则需要告诉 Apache 在该端口上侦听 SSL 连接:

      Listen 192.168.0.1:8443 https
      
    4. 如果您在 &lt;If DefineSSL&gt; 块内看到上述内容,则需要确保在启动 Apache 时定义了 SSL。通常 SSL 应自行定义,但如果未定义,您可以尝试对早期版本的 Apache 2 执行以下命令:

      path/to/httpd -D SSL -k start
      path/to/apachectl startssl
      path/to/httpd startssl
      
    5. 如果您在 Windows 下运行 Apache,请确保 Windows 服务器上的主机文件设置正确。它应该在C:\Windows\System32\Drivers\etc\hosts。有些人通过将VirtualHost your.domain.com:443 更改为VirtualHost _default_:443 等来修复此错误。

    6. 确保在 &lt;VirtualHost&gt; 块中,Apache 配置为使用带有 SSLEngine 指令的 SSL,如下所示:

      <VirtualHost your.domain.com:443>
      SSLEngine On
      [rest of VirtualHost]
      </VirtualHost>
      

    【讨论】:

      猜你喜欢
      • 2012-02-01
      • 2011-02-02
      • 2013-09-09
      • 2012-12-20
      • 1970-01-01
      • 2016-07-04
      • 2021-02-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多