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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2538723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:59:02  来源:igfitidea点击:

SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)

apachessl

提问by Webnet

I followed the official docs on https setup located here: https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html#https-configuration

我按照位于此处的 https 设置的官方文档进行操作:https: //help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html#https-configuration

I had to remove the +CompatEnvVarsfrom

我不得不+CompatEnvVars

SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire

because it said it was an invalid command or something. So having removed that and following the instructions to the nail it get the error:

因为它说这是一个无效的命令什么的。因此,删除它并按照钉子的说明进行操作后,会出现错误:

SSL received a record that exceeded the maximum permissible length.

(Error code: ssl_error_rx_record_too_long)

I'm new to SSL, any advice on what's going wrong?

我是 SSL 的新手,对出了什么问题有什么建议吗?

采纳答案by Greg B

I've just experienced this issue. For me it appeared when some erroneous code was trying to redirect to HTTPS on port 80.

我刚刚经历过这个问题。对我来说,它出现在一些错误的代码试图重定向到端口 80 上的 HTTPS 时。

e.g.

例如

https://example.com:80/some/page

https://example.com:80/some/page

by removing the port 80 from the url, the redirect works.

通过从 url 中删除端口 80,重定向工作。

HTTPS by default runs over port 443.

HTTPS 默认通过端口 443 运行。

回答by Anolim

I used

我用了

a2ensite default-ssl

and it worked like a charm.

它就像一个魅力。

If you want to force e.g. phpmyadmin to use SSL/https you will run into this problem if this link is missing.

如果您想强制例如 phpmyadmin 使用 SSL/https,如果缺少此链接,您将遇到此问题。

回答by oferrero

I had that same error. I forgot to create a link from sites-enabled/000-default-ssl to the sites-available/default-ssl file.

我有同样的错误。我忘记创建从sites-enabled/000-default-ssl 到sites-available/default-ssl 文件的链接。

> ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl 

回答by Russell Fulton

This seems to be the result you see from Firefox when the server is not configured properly for SSL. Chrome, BTW, just gave a generic "ssl failed" code.

当服务器没有正确配置 SSL 时,这似乎是您从 Firefox 看到的结果。顺便说一句,Chrome 只是给出了一个通用的“ssl 失败”代码。

What happens is that the browser sends a SSL handshake when the server is expecting an HTTP request. Server responds with a 400 code and an error message that is much bigger that the handshake message that the browser expects. Hence the FF message.

发生的情况是,当服务器期待 HTTP 请求时,浏览器发送 SSL 握手。服务器以 400 代码和比浏览器期望的握手消息大得多的错误消息响应。因此是FF消息。

As we can see from the responses here there are many things that can break the SSL configuration but not stop the server starting or give any hints in error.log.

正如我们从这里的响应中看到的,有很多事情可以破坏 SSL 配置,但不会停止服务器启动或在 error.log 中给出任何提示。

What I did was systematically check down all the answers until I finally found the right one, right at the bottom.

我所做的是系统地检查所有答案,直到我最终找到正确的答案,就在底部。

Here is what I had in the access logs:

这是我在访问日志中的内容:

rfulton.actrix.co.nz:80 192.168.1.3 - - [09/Oct/2016:13:39:32 +1300] "\x16\x03\x01" 400 0 "-" "-"
rfulton.actrix.co.nz:80 192.168.1.3 - - [09/Oct/2016:13:39:46 +1300] "\x16\x03\x01" 400 0 "-" "-"
rfulton.actrix.co.nz:80 192.168.1.3 - - [09/Oct/2016:13:49:13 +1300] "\x16\x03\x01" 400 0 "-" "-"

回答by Pierz

This error also occurs when you have enabled the SSL module (i.e. you have run e.g. a2enmod ssl) but not yet enabled any SSL site entries (i.e you have not run e.g. a2ensite default-ssl).

当您启用了 SSL 模块(即您已运行 eg a2enmod ssl)但尚未启用任何 SSL 站点条目(即您尚未运行 eg a2ensite default-ssl)时,也会发生此错误。

回答by a coder

In my case I copied a ssl config from another machine and had the wrong IP in <VirtualHost wrong.ip.addr.here:443>. Changed IP to what it should be, restarted httpd and the site loaded over SSL as expected.

就我而言,我从另一台机器复制了一个 ssl 配置,并且在<VirtualHost wrong.ip.addr.here:443>. 将 IP 更改为应有的值,重新启动 httpd 并按预期通过 SSL 加载站点。

回答by blizz

In my case, I needed to install mod_ssl first

就我而言,我需要先安装 mod_ssl

yum install mod_ssl

回答by nanospeck

I go this error when I was trying to access a url using curl :

当我尝试使用 curl 访问 url 时出现此错误:

curl 'https://example.com:80/some/page'

The solution was to change httpsto http

解决方案是https改为http

curl 'http://example.com:80/some/page'

回答by Adams

In my case, an Ubuntu system, in ports.conf I had

在我的例子中,一个 Ubuntu 系统,在 ports.conf 我有

NameVirtualHost *:80
NameVirtualHost 192.168.1.79
Listen 80

And then, inside , I had

然后,在里面,我有

NameVirtualHost *:443
Listen 443

All I had to do was remove the line NameVirtualHost 192.168.1.79. Restarted apache and problem solved.

我所要做的就是删除 NameVirtualHost 192.168.1.79 这一行。重启apache,问题解决。

回答by Smitha Surendra

Below Solution worked for me :

以下解决方案对我有用:

Type About:Config in the Address Bar and press Enter.

在地址栏中键入 About:Config,然后按 Enter。

“This Might void your warranty!” warning will be displayed, click on I'll be careful, I Promise button.

“这可能会使您的保修失效!” 会显示警告,点击我会小心,我承诺按钮。

Type security.ssl.enable_ocsp_stapling in search box.

在搜索框中键入 security.ssl.enable_ocsp_stapling。

The value field is true, double click on it to make it false.

值字段为真,双击它使其为假。

Now try to connect your website again.

现在尝试再次连接您的网站。