运行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>
是语法错误,我该如何纠正?
答案 0 :(得分:1)
这通常意味着您要向HTTP服务发送HTTPS请求。该消息来自浏览器,抱怨它无法完成预期的SSL握手。语法是正确的,否则HTTPD就不会重新启动httpd服务。
答案 1 :(得分:0)
文件/conf/extra/httpd-ssl.conf
配置了正确的SSL信息但未加载,因为httpd.conf未加载它。
要修复此错误,请取消注释以下行(删除#)。然后重启Apache。
#Include conf/extra/httpd-ssl.conf
Apache未设置为侦听端口443以获取安全流量。要解决此问题,请在加载<VirtualHost>
块之前添加以下行:
Listen 443
如果您使用的是IPv6,则需要包含IP地址和端口:
Listen 192.168.0.1:443
如果您在非标准端口上运行HTTPS,则需要告知Apache在该端口上侦听SSL连接:
Listen 192.168.0.1:8443 https
如果您在<If DefineSSL>
块中看到上述内容,则需要确保在启动Apache时定义SSL。通常情况下,SSL应该自己定义,但如果没有定义,您可以为早期版本的Apache 2尝试以下命令:
path/to/httpd -D SSL -k start
path/to/apachectl startssl
path/to/httpd startssl
如果您在Windows下运行Apache,请确保Windows服务器上的主机文件已正确设置。它应该在C:\Windows\System32\Drivers\etc\hosts
中。有些人通过将VirtualHost your.domain.com:443
更改为VirtualHost _default_:443
等
确保在<VirtualHost>
块中将Apache配置为使用带有SSLEngine
指令的SSL,如下所示:
<VirtualHost your.domain.com:443>
SSLEngine On
[rest of VirtualHost]
</VirtualHost>