Sudhakar R
Sudhakar R

Reputation: 627

Bitnami on Google Cloud Platform enabling SSL Issue: Please fix DNS entries while enabling SSL

I am using the bitnami django on Google Cloud platform stack.

Goal: I want SSL configured on my bitnami stack hosted on Google Cloud. But their toolsudo ./bncert-tool complains "The domain resolves to a different IP address than the one detected for this machine. Please fix its DNS entries or remove it.

I have purchased a domain using google domains.

I have set up google dns to point to the IP address as I see in the bitnami stack. I have enabled mydomain.com and www.mydomain.com to forward to the cloud server ipaddress/home in Google domain name settings

I then tried to run the tool /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:

MY QUESTION: How do I resolve this? I even tried adding both domains mydomain.com www.mydomain.com

I want SSL enabled for mydomain.com and www.mydomain.com and not sure where I am going wrong?

Secondy, after the link forwards, how to associate my domain name so that the static IP doesn't keep displaying instead it shows the mapped domain mydomain.com/home

thanks Suds

$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.

Upvotes: 2

Views: 2515

Answers (1)

Sudhakar R
Sudhakar R

Reputation: 627

You may need to change certain settings such as the domain name settings. If using Google Domains, the forwards actually don't integrate the A + Cname to one static IP. I had to physically create A and CName records.

This solved the first issue: What is interesting is one of my domains: mydomain.com is pointing multiple IP address whereas the other is point to different IP depending upon the DNS Server. This was also the one contributing to the error I used to get

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. 

I think physically forced the HTTPS redirection in web server settings. using this rule

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

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

Then I still had some problems where the first hit the URLs will load, the next hit I would 404 errors.

I realized this was an issue with project level settings

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'

Then was the issue with ALLOWED HOSTS in settings.py: Ensure the right ALLOWED HOSTS is updated, the project root or your application root, depending upon where you serve from. /opt/bitnami/apps/django/django_projects/Project/Project updated the settings in py here... ALLOWED_HOSTS in settings.py

Upvotes: 1

Related Questions