Apache SSL 配置错误(SSL 连接错误)
我正在尝试在我的服务器上配置 Apache 以使用 ssl,但每次访问我的网站时,我都会得到我的浏览器中显示以下消息:
SSL 连接错误。 无法与服务器建立安全连接。这可能是服务器的问题,或者可能需要您没有的客户端身份验证证书。 错误 107 (net::ERR_SSL_PROTOCOL_ERROR):SSL 协议错误。
上面的错误消息似乎是 Google Chrome 固有的。然而,即使消息不同,该网站的 ssl 也无法在任何浏览器上运行。
只是一些有关情况的背景:我正在使用 Ubuntu 10.04 桌面版
。
我通过安装 zend server
安装了 apache
(它自动安装了 apache)。 然后我安装了 openssl。非 https 页面在网站上运行良好。
我尝试从多个证书站点获取试用证书,但没有任何效果(相同的错误)。
我之前将我的网站托管在另一台服务器上,ssl 在该服务器上运行得很好。我还尝试使用该服务器中的密钥和证书文件,但出现了相同的错误。
不过域名和IP还是一样的。我的 SSLCertificateFile
和 SSLCertificateKeyFile
指向正确的目录和文件。
我也没有启用 SSLVerifyClient。
如果有人有任何建议,我们将不胜感激。
I'm trying to configure Apache on my server to work with ssl, but everytime I visit my site, I get the following message in my browser:
SSL connection error.
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
The error message above seems to be native to Google Chrome. However, even though the messages are different, ssl for the site is not working on any browser.
Just some background on the situation: I am using Ubuntu 10.04 desktop edition
.
I installed apache
by installing zend server
(it installed apache automatically).
I then installed openssl
. Non-https pages work fine on the site.
I tried getting trial certificates from multiple certificate sites but nothing is working (same error).
I was previously hosting my site on another server on which ssl worked just fine. I also tried using the key and cert file from that server, but I got the same error.
The domain name and IP are still the same though. My SSLCertificateFile
and SSLCertificateKeyFile
are pointing to the correct directory and files.
I also do not have SSLVerifyClient enabled.
If anyone has any suggestions, it would be most appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
我和@User39604有同样的问题,并且必须遵循各种建议。由于他不记得他遵循的确切路径,让我列出我的路径:
使用
检查您是否有 SSL YES
如果需要
A. 在 apache 上启用 ssl
sudo a2enmod ssl
B. 安装 openssl
sudo apt-get install openssl
C.检查端口443是否打开
sudo netstat -lp
D.如有必要,更改
/etc/apache2/ports.conf
,这有效获取密钥和证书
A. 向认证机构(Comodo、GoDaddy、Verisign)支付一对费用
B. 生成您自己的* - 参见下文(仅用于测试目的)
更改您的配置(在 ubuntu12 中
/etc/apache2/httpd.conf< /code> - 默认为空文件)以包含正确的
(替换
MYSITE.COM
以及密钥和证书路径/名称以指向您的证书和密钥):而许多其他虚拟主机配置将在
/etc/apache2/sites-enabled 中提供/
在/etc/apache2/sites-available/
中,/etc/apache2/httpd.conf
对于解决所有问题至关重要。欲了解更多信息:
http://wiki.vpslink.com/Enable_SSL_on_Apache2
http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#selfcert
*生成您自己的证书(自签名)将导致用户浏览器无法识别其权限的证书。因此,浏览器会尖叫血腥谋杀,用户在浏览器真正打开页面之前必须“了解风险”十几次。因此,它仅适用于测试目的。话虽如此,这是操作方法:
/etc/apache2/
中)ssl
的文件夹(或任何适合您的文件夹) ,该名称不是系统要求)/etc/apache2/ssl
sudo openssl req -new -x509 -nodes -out MYSITE.COM.crt -keyout MYSITE.COM .key
标记名称格式中使用
MYSITE.COM.crt
和MYSITE.COM.key
不是在严格的系统要求下,必须与文件相同:)- 像
212-MYSITE.COM.crt
、june2014-Godaddy-MYSITE.COM.crt
这样的名称应该有效。I had the same problem as @User39604, and had to follow VARIOUS advices. Since he doesnt remember the precise path he followed, let me list my path:
check if you have SSL YES using
<?php echo phpinfo();?>
if necessary
A. enable ssl on apache
sudo a2enmod ssl
B. install openssl
sudo apt-get install openssl
C. check if port 443 is open
sudo netstat -lp
D. if necessary, change
/etc/apache2/ports.conf
, this worksacquire a key and a certificate by
A. paying a Certificating Authority (Comodo, GoDaddy, Verisign) for a pair
B. generating your own* - see below (testing purposes ONLY)
change your configuration (in ubuntu12
/etc/apache2/httpd.conf
- default is an empty file) to include a proper<VirtualHost>
(replace
MYSITE.COM
as well as key and cert path/name to point to your certificate and key):while many other virtualhost configs wil be available in
/etc/apache2/sites-enabled/
and in/etc/apache2/sites-available/
it was/etc/apache2/httpd.conf
that was CRUCIAL to solving all problems.for further info:
http://wiki.vpslink.com/Enable_SSL_on_Apache2
http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#selfcert
*generating your own certificate (self-signed) will result in a certificate whose authority the user's browser will not recognize. therefore, the browser will scream bloody murder and the user will have to "understand the risks" a dozen times before the browser actually opens up the page. so, it only works for testing purposes. having said that, this is the HOW-TO:
/etc/apache2/
)ssl
(or anything that works for you, the name is not a system requirement)/etc/apache2/ssl
sudo openssl req -new -x509 -nodes -out MYSITE.COM.crt -keyout MYSITE.COM.key
MYSITE.COM.crt
andMYSITE.COM.key
in your<VirtualHost>
tagname format is NOT under a strict system requirement, must be the same as the file :)
- names like
212-MYSITE.COM.crt
,june2014-Godaddy-MYSITE.COM.crt
should work.我在 chrome 中遇到了同样的错误(在 Firefox、IE 中遇到了不同的错误)。
另外,在 error.log 中,我收到
[error] [client cli.ent.ip.add] Invalid method in request \x16\x03
按照此站点中的说明操作,我将配置从:更改
为:
现在工作正常:)
I was getting the same error in chrome (and different one in Firefox, IE).
Also in error.log i was getting
[error] [client cli.ent.ip.add] Invalid method in request \x16\x03
Following the instructions form this site I changed my configuration FROM:
TO:
Now it's working fine :)
正确启用 SSL 的步骤。
在 SSL 配置文件 (default-ssl.conf) 中配置 SSL 证书的路径,该文件可能位于 /etc/apache2/sites-available 中。我已将证书存储在 /etc/apache2/ssl/
启用 SSL 配置文件下
Step to enable SSL correctly.
Configure the path of SSL certificates in your SSL config file (default-ssl.conf) that might be located in /etc/apache2/sites-available. I have stored certificates under /etc/apache2/ssl/
Enable SSL config file
对于这种情况,我想提出一个常见原因:
有时,客户正在运行 Skype,该应用正在使用端口 443,而他们却没有意识到。当他们启动 Tomcat 或 Apache 时,它似乎已启动,但无法与端口 443 绑定。这正是用户在浏览器中收到的消息。修复方法是停止在端口 443 上运行的程序并重新启动 Web 服务器,以便它可以与端口 443 绑定。
客户可以在启动 Web 服务器后重新启动 Skype,Skype 将检测到端口 443 正在使用并选择一个使用不同的端口。
A common cause I wanted to suggest for this situation:
Sometimes a customer is running Skype, which is using port 443 without their realizing it. When they go to start Tomcat or Apache, it appears to start but cannot bind with port 443. This is the exact message that the user would receive in the browser. The fix is to stop what was running on port 443 and re-start the webserver so it can bind with port 443.
The customer can re-start Skype after starting the webserver, and Skype will detect that port 443 is in use and choose a different port to use.
我遇到了这个问题,解决方案有点愚蠢。
我正在使用 Cloudflare,它充当我网站的代理。为了能够通过 SSH 登录,我在
/etc/hosts
文件中添加了一个条目,这样我就不需要记住服务器的 IP 地址。因此,当我在浏览器中访问 https://www.example.com 时,我正在使用 Cloudflare 代理,当我访问 https://example.com 时,我直接访问服务器。由于 Cloudflare 设置不需要您添加中间证书,因此当我访问 https: 时,我在浏览器中看到了此安全异常: //example.com,但 https://www.example.com 正在运行。
解决方案:从我的笔记本电脑的
/etc/hosts
文件中删除该条目。如果这不是您的问题,我建议使用众多在线 SSL 检查工具之一尝试诊断您的问题。
我还建议使用 ping 来检查报告的 IP 地址,并根据预期的 IP 地址进行检查。
另一个非常有用的 SSL 资源是 Mozilla SSL 配置生成器 。它可以为您生成 SSL 配置。
I got this problem and the solution was a bit silly.
I am using Cloudflare which acts as a proxy to my website. In order to be able to login via SSH, I added an entry to my
/etc/hosts
file so I didn't need to remember my server's IP address.So in my browser when I went to https://www.example.com, I was using the Cloudflare proxy, and when I went to to https://example.com I was going directly to the server. Because the Cloudflare setup doesn't require you to add the intermediate certificates, I was seeing this security exception in my browser when I went to https://example.com, but https://www.example.com was working.
The solution: remove the entry from my laptop's
/etc/hosts
file.If this isn't your problem, I recommend using one of the many online SSL checker tools to try diagnose your problem.
I also recommend using ping to check the IP address being reported and check it against the IP address expected.
Another very helpful SSL resource is the Mozilla SSL Configuration Generator. It can generate SSL configuration for you.
当我开始更改 Apache 配置时,我不知道自己在做什么。我捡起了一些零碎的东西,认为它可以工作,直到我遇到了你遇到的同样的问题,特别是 Chrome 出现了这个错误。
我所做的就是注释掉所有用于配置 SSL 验证的特定于站点的指令,确认 Chrome 让我进入,在重新启用指令之前查看指令之前的文档,然后重新启动 Apache。通过仔细检查这些,您应该能够找出哪些问题导致了您的问题。
就我而言,我从这个:
到这个
正如你所看到的,我做了相当多的改变才能到达那里。
I didn't know what I was doing when I started changing the Apache configuration. I picked up bits and pieces thought it was working until I ran into the same problem you encountered, specifically Chrome having this error.
What I did was comment out all the site-specific directives that are used to configure SSL verification, confirmed that Chrome let me in, reviewed the documentation before directive before re-enabling one, and restarted Apache. By carefully going through these you ought to be able to figure out which one(s) are causing your problem.
In my case, I went from this:
to this
As you can see I had a fair number of changes to get there.
当我第一次按照说明设置默认 apache2 ssl 配置时,通过在
/etc/apache2 中放置
。然后,我随后尝试在另一个配置文件中的端口 443 上添加另一个 NameVirtualHost,并开始收到此错误。/etc/apache2/sites-available/default-ssl
的符号链接,出现此错误/启用站点我通过删除
/etc/apache2/sites-enabled/default-ssl
符号链接来修复它,然后将这些行放在另一个配置文件中(httpd.conf,这可能不是一个好的形式,但有效):I had this error when I first followed instructions to set up the default apache2 ssl configuration, by putting a symlink for
/etc/apache2/sites-available/default-ssl
in/etc/apache2/sites-enabled
. I then subsequently tried to add another NameVirtualHost on port 443 in another configuration file, and started getting this error.I fixed it by deleting the
/etc/apache2/sites-enabled/default-ssl
symlink, and then just having these lines in another config file (httpd.conf, which probably isn't good form, but worked):我遇到这个问题,因为我在 httpd.conf 和 httpd-ssl.conf 中定义了
。在httpd.conf中,它的定义如
httpd-ssl.conf中,它的定义为
以下更改解决了这个问题,在httpd.conf中添加:80
I encounter this problem, because I have
<VirtualHost>
defined both in httpd.conf and httpd-ssl.conf.in httpd.conf, it's defined as
in httpd-ssl.conf, it's defined as
The following change solved this problem, add :80 in httpd.conf
这就是我在 Ubuntu 上修复它的原因。
a2enmod ssl
/usr/local/ssl
并使其可读:chmod -R +r /usr /local/ssl
更改为
。SSLEngine On
。如果您在证书上设置了密码短语,Apache 会在重新启动时提示您输入该密码。
This is what fixed it for me on Ubuntu.
a2enmod ssl
/usr/local/ssl
and made it world readable:chmod -R +r /usr/local/ssl
<VirtualHost *:80>
to<VirtualHost *:*>
in my virtual host.SSLEngine On
before all other SSL directives in my virtual host.If you set a pass phrase on the cert, Apache should prompt you for it on restart.
与其他答案类似,当没有站点配置为使用 SSL 时,可能会遇到此错误。
我从 Debian Wheezy 升级到 Debian Jessie 时遇到错误。新版本的 Apache 需要一个以
.conf
结尾的站点配置文件。因为我的配置文件没有,所以它被忽略,并且没有其他配置文件来提供 SSL 连接。Similar to other answers, this error can be experienced when there are no sites configured to use SSL.
I had the error when I upgraded from Debian Wheezy to Debian Jessie. The new version of Apache requires a site configuration file ending in
.conf
. Because my configuration file didn't, it was being ignored, and there were no others configured to serve SSL connections.我也遇到过这个问题,也是由于配置错误造成的。我正在使用 tomcat 并在 server.xml 中指定了我的连接器:
当我这样修复它时:
它按预期工作。换句话说,验证您不仅拥有正确的密钥库,而且在其下指定了正确的别名。感谢您提供宝贵的提示user396404。
I encountered this issue, also due to misconfiguration. I was using tomcat and in the server.xml had specified my connector as such:
When i fixed it thusly:
It worked as expected. In other words, verify that you not only have the right keystore, but that you have specified the correct alias underneath it. Thanks for the invaluable hint user396404.
我通过注释掉它解决了这个问题:
AcceptFilter https none
httpd.conf 中的
根据:
http://www.apachelounge.com/viewtopic.php?t=4461
I solved it by commenting out:
AcceptFilter https none
in httpd.conf
according to:
http://www.apachelounge.com/viewtopic.php?t=4461
对我来说,这实际上是一个无效的协议。
我的虚拟主机指定了如下所示的有效协议:
此行导致错误消息,与“-TLSv1”有关。
不过,我最终将其更改为:
问题解决了!
For me this literally was an invalid protocol.
My virtual host specified valid protocols like this:
This line was causing the error message, something to do with "-TLSv1".
However, I ended up changing it to:
Problem solved!
原来是SSL证书安装不正确。重新安装即可正确解决问题
It turns out that the SSL certificate was installed improperly. Re-installing it properly fixed the problem