【问题标题】:Bitnami on Google Cloud Platform enabling SSL Issue: Please fix DNS entries while enabling SSLGoogle Cloud Platform 上的 Bitnami 启用 SSL 问题:请在启用 SSL 时修复 DNS 条目
【发布时间】:2019-10-30 05:23:34
【问题描述】:

我在 Google Cloud 平台堆栈上使用 bitnami django。

目标:我希望在托管在 Google Cloud 上的 bitnami 堆栈上配置 SSL。但是他们的 toolsudo ./bncert-tool 抱怨“该域解析到的 IP 地址与为这台机器检测到的 IP 地址不同。请修复其 DNS 条目或将其删除。

我使用谷歌域名购买了一个域名。

我已将 google dns 设置为指向我在 bitnami 堆栈中看到的 IP 地址。我在谷歌域名设置中启用了mydomain.com和www.mydomain.com转发到云服务器ipaddress/home

然后我尝试运行工具 /opt/bitnami/bncert-tool:

sudo /opt/bitnami/bncert-tool


Welcome to the Bitnami HTTPS Configuration tool.

Domains

Please provide a valid space-separated list of domains for which you wish to
configure your web server.

Domain list []: mydomain.com

The following domains were not included: www.mydomain.com. Do you want to add them? [Y/n]: n

Warning: No www domains (e.g. www.example.com) or non-www domains (e.g.
www.example.com) have been provided, so the following redirections will be
disabled: non-www to www, www to non-www.
Press [Enter] to continue:
Warning: The domain 'mydomain.com' resolves to a different IP address than the
one detected for this machine, which is 'aa.bb.ccc.dddd'. Please fix its DNS
entries or remove it. For more info see:
https://docs.bitnami.com/general/faq/configuration/configure-custom-domain/
Press [Enter] to continue:

我的问题: 我该如何解决这个问题?我什至尝试添加两个域 mydomain.com www.mydomain.com

我想为 mydomain.com 和 www.mydomain.com 启用 SSL,但不知道哪里出错了?

其次,链接转发后,如何关联我的域名,这样静态IP就不会一直显示,而是显示映射的域mydomain.com/home

谢谢 泡沫

$nslookup mydomain
Server:     192.168.0.1
Address:    192.168.0.1#53

Non-authoritative answer:
Name:   mydomain.com
Address: 216.239.32.21
Name:   mydomain.com
Address: 216.239.34.21
Name:   mydomain.com
Address: 216.239.36.21
Name:   mydomain.com
Address: 216.239.38.21
$ nslookup www.mydomain.com
Server:     192.168.0.1
Address:    192.168.0.1#53

Non-authoritative answer:
www.mydomain.com    canonical name = ghs.googlehosted.com.
Name:   ghs.googlehosted.com
Address: 172.217.26.179


$ dig +short NS mydomain.com ns-cloud-b1.googledomains.com.
ns-cloud-b2.googledomains.com. ns-cloud-b3.googledomains.com.
ns-cloud-b4.googledomains.com.

$ dig +short NS www.mydomain.com ghs.googlehosted.com.

【问题讨论】:

  • 在您的问题中显示您的 DNS 服务器记录。使用 MxToolbox 等 Internet 工具来测试您的域的记录。这会告诉你什么是错的。注意:对 DNS 服务器的更改需要时间,有时一天才能生效。仔细计划您的更改。详情谷歌搜索 DNS TTL。
  • 我查看了 mydomain.com 和 www.mydomain.com 的 DNS 记录。有趣的是我的一个域:mydomain.com 指向多个 IP 地址,而另一个指向不同的 IP,具体取决于 DNS 服务器。我使用whatsmydns.net/#A/mydomain.comwhatsmydns.net/#A/www.mydomain.com 来获取详细信息。 bitnami 有人说这意味着您正在使用负载均衡器或 CDN),而另一个指向不同的 IP 地址,具体取决于 DNS 服务器。
  • 我只是使用谷歌作为域名注册商,如何解决这个 DNS 问题。我所做的只是转发 mydomain.com -> 当我启动在 Google Cloud Platform 上运行的 bitnami django 云实例时获得的静态 IP。我实际上没有启动任何负载均衡器等。
  • 显示您的 DNS 服务器记录。这些信息不是秘密。 DNS 服务器记录是公共信息。如果没有,请使用 MxToolbox 来解决。
  • 我将通过我为解决此问题而采取的步骤来解决此问题。

标签: ssl google-cloud-platform bitnami


【解决方案1】:

您可能需要更改某些设置,例如域名设置。如果使用 Google Domains,转发实际上不会将 A + Cname 集成到一个静态 IP。我必须实际创建 A 和 CName 记录。

这解决了第一个问题:有趣的是我的一个域:mydomain.com 指向多个 IP 地址,而另一个指向不同的 IP 地址,具体取决于 DNS 服务器。这也是导致我以前遇到的错误的原因

when I ran sudo ./bncert-tool "The domain 'mydomain.com' resolves to a different IP address than the one detected for this machine, which is 'aa.bb.ccc.ddd'. Please fix its DNS entries or remove it. 

我认为在 Web 服务器设置中物理上强制了 HTTPS 重定向。使用这条规则

/opt/bitnami/apache2/conf/bitnami/bitnami.conf,

Changed  RewriteRule ^/(.*) https://example.com/$1 [R,L]

然后我仍然有一些问题,第一次点击 URL 将加载,下一次点击我会 404 错误。

我意识到这是项目级别设置的问题

opt/bitnami/apps/django/django_projects/Project/conf

sudo vi httpd-app.conf

WSGIScriptAlias /PROJECT '/opt/bitnami/apps/django/django_projects/PROJECT/PROJECT/wsgi.py'

to

WSGIScriptAlias / '/opt/bitnami/apps/django/django_projects/myproject/myproject/wsgi.py'

然后是 settings.py 中 ALLOWED HOSTS 的问题: 确保更新了正确的 ALLOWED HOSTS,项目根目录或应用程序根目录,具体取决于您从何处提供服务。 /opt/bitnami/apps/django/django_projects/Project/Project 在这里更新了py中的设置... settings.py 中的 ALLOWED_HOSTS

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    相关资源
    最近更新 更多