Apache 配置问题(Google 托管证书和 HTTPS LB)

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

如果我按照这个说明,我就能得到你好世界!在浏览器上。

获得域名后,使用cloud dns将虚拟机外部IP指向该域名,我也能够获得hello world!在浏览器输入域名后,例如newdany.us.to

现在我想使用 SSL,https://newdany.us.to,以便浏览器向我返回 hello world!与 https。我能够使用谷歌管理的证书创建我的 https lb。证书已正确提供。我还在 Cloud DNS 上进行了更改以指向新的 LB IP,但是当我输入 https://newdany.us.to

时收到此错误
upstream connect error or disconnect/reset before headers. retried and the latest reset reason: remote connection failure, transport failure reason: delayed connect error: 111

我希望社区能够为我指明正确的方向,需要在服务器内部进行更改,以便 https 正常工作。预先感谢您。

我的 000-default.conf 文件如下

<VirtualHost *:80>
        ServerName newdany.us.to
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

我已在 000-default.conf 文件中添加了这一行 ServerName newdany.us.to,但我不确定这是否正确。


创建了我的前端

  • 我在 /var/www/sites/abc/index.html 创建了一个新的索引文件
  • 创建了一个名为 abc.com.conf 的新conf文件
  • 更改 DocumentRoot 使其指向新的索引文件
  • 使用以下命令禁用旧配置:sudo a2dissite 000-default.conf
  • 激活新的:sudo a2ensite abc.com.conf
  • sudo 服务 apache2 重新加载
apache google-cloud-platform google-cloud-load-balancer gcp-load-balancer
1个回答
0
投票

将 John Hanley 先生的评论发布为答案。

虽然可以在

000-default.conf,
中包含主机名,但更常见的做法是禁用此默认配置,并为您希望 Apache 服务的每个域创建单独的虚拟主机配置。

许多在线教程提供了有关虚拟主机的详细说明以及在 Apache 中有效设置虚拟主机的指导。

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