启用HTTPS后访问网站时,谷歌浏览器显示ERR_SSL_PROTOCOL_ERROR

问题描述 投票:0回答:1

我有一个由Google Compute Engine托管的网页,安装了Apache 2.4。我可以按http://1.2.3.4/确定访问该页面。现在我要启用SSL。我遵循了两个相似的教程herehere。总结一下我所做的:

  1. 创建证书.crt和密钥.key文件。
  2. 通过将/etc/apache2/sites-available/default-ssl.conf更改为ServerName,然后在步骤1中将1.2.3.4SSLCertificateFile更改为证书和密钥文件来编辑文件SSLCertificateKeyFile
  3. 编辑块/etc/apache2/sites-available/000-default.conf中的文件<VirtualHost *:80>以使其具有与IP相同的ServerName,然后复制该块,但使用与<VirtualHost *:443>不同的端口
  4. 使用此命令sudo ufw allow 'Apache Full'允许在防火墙中使用Apache配置文件>
  5. 使用sudo a2enmod ssl启用ssl mod,然后使用sudo a2ensite default-ssl.conf启用配置
  6. 重新启动服务器sudo service apache2 restart
  7. 在Chrome中,当我访问https://1.2.3.4/https://1.2.3.4:443/时,显示为:

此网站无法提供安全的连接

1.2.3.4发送了无效的响应。

尝试运行Windows网络诊断程序。

ERR_SSL_PROTOCOL_ERROR

这是我的000-default.conf文件的内容:

<VirtualHost *:80>
    ServerName 1.2.3.4
    ServerAdmin webmaster@localhost
    DocumentRoot /home/usename/mypage
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:443>
    ServerName 1.2.3.4
    ServerAdmin webmaster@localhost
    DocumentRoot /home/usename/mypage
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

访问http链接仍然可以(我没有将HTTP流量重定向到HTTPS)。如何使https工作? (我的Google Compute Engine是Ubuntu 18.04.3)

我有一个由Google Compute Engine托管的网页,安装了Apache 2.4。我可以通过例如http://1.2.3.4/ ok访问该页面。现在我要启用SSL。我遵循了两个类似的...

apache ssl ubuntu-18.04 apache2.4
1个回答
-1
投票

您需要在VirtualHost(000-default.conf)中添加SSLEngine On。此伪指令可切换SSL / TLS协议引擎的用法。默认情况下,主服务器和所有已配置的虚拟主机均禁用SSL / TLS协议引擎。

© www.soinside.com 2019 - 2024. All rights reserved.