gpt4 book ai didi

apache - EC2 SSL 不工作

转载 作者:太空宇宙 更新时间:2023-11-03 13:09:06 25 4
gpt4 key购买 nike

我正在运行一个 EC2 微型实例 (Amazon Linux),但似乎无法使 ssl (https) 正常工作。

我在 Chrome 中遇到的错误是“ERR_CONNECTION_REFUSED”(未发送数据)。

我已在我的 AWS 控制台中为安全组启用 HTTPS 入站流量。

我在/etc/httpd/conf/httpd.conf 文件中添加了这个。 (example.com 是我网站的占位符)

<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile /etc/ssl/example_com.crt
SSLCertificateKeyFile /etc/ssl/example_com.key
SSLCertificateChainFile /etc/ssl/example_com.ca-bundle
</VirtualHost>

但它没有用。

所以为了测试 VirtualHost,我将其替换为以下内容:

<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://google.com/
</VirtualHost>

<VirtualHost *:443>
ServerName example.com
Redirect permanent / https://google.com/
</VirtualHost>

http://example.com像预期的那样重定向到谷歌,但是https://example.com没有。

有人知道问题出在哪里吗?

最佳答案

连接被拒绝意味着您的服务器的 IP 堆栈主动拒绝了端口 443 (https) 上的传入连接,因为没有服务正在监听端口 443。

这些天我们在操作中使用的 Apache 越来越少,因为其他一些替代方案已经成熟,所以我在这里可能有点生疏,但我有理由相信你的服务器,尽管配置了响应端口 443 上的请求的方式...实际上不是 监听端口 443 上的连接

您的 apache 配置中可能有一个 listen 80。这需要伴随着 listen 443 基于 httpd.apache.org/docs/2.2/bind.html:

When Apache starts, it binds to some port and address on the local machine and waits for incoming requests. By default, it listens to all addresses on the machine. However, it may need to be told to listen on specific ports, or only on selected addresses, or a combination of both. This is often combined with the Virtual Host feature, which determines how Apache responds to different IP addresses, hostnames and ports.

关于apache - EC2 SSL 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32053482/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com