I'm not very skilled at debugging DNS issues. I'm trying to configure two named virtual hosts in apache2 at foo.com and dev.foo.com
Currently I'm getting a DNS error that I'm not sure how to resolve, and whether it's related to my apache configuration. However, apache does not complain or submit an error log on reload.
dns_master_load: /dev/shm/bind/DO/db.foo.com:14: www.foo.com: CNAME and other data
zone foo.com/IN: loading from master file /dev/shm/bind/DO/db.foo.com failed: CNAME and other data
zone foo.com/IN: not loaded due to errors.
My zone file is the following:
$TTL 1800
# IN SOA NS1.nsexample.COM. hostmaster.foo.com. (
1378763038 ; last update: 2013-09-09 21:43:58 UTC
3600 ; refresh
900 ; retry
1209600 ; expire
1800 ; ttl
)
IN NS NS1.nsexample.COM.
NS NS2.nsexample.COM.
NS NS3.nsexample.COM.
# IN A 123.456.78.910
www IN A 123.456.78.910
www CNAME #
ww CNAME #
dev IN A 123.456.78.910
Thanks in advance for the help!
You cannot have CNAME and any other record for the same DNS name:
www IN A 123.456.78.910
www CNAME #
In this case the second line is superfluous, you can delete the CNAME record.
You are missing the IN in CNAME and the www CNAME is redundant. It should be:
# IN A 123.456.78.910
www IN A 123.456.78.910
ww IN CNAME #
dev IN A 123.456.78.910
If it were up to me though, I would change it to:
# IN A 123.456.78.910
www IN A 123.456.78.910
ww IN A 123.456.78.910
dev IN A 123.456.78.910
Use A records where possible, saves having to create MX and NS records. It also saves having to fetch any CNAME/A records it is attached to.
Related
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.
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
I have several questions about dns. I have apache server on my computer and static ip and i bought domain. So when i enter in my browser blablabla.com , it redirects me to my site. Its ok. But i want to setup my own dns server on the same computer where i have my site. I set up bind9. Here are some questions:
Should i buy two domain's, so there will be my dns server and is it necessarily that ns will look like ns1.blablabla.com or its ok if it is blublublu.com ?
When i buy domain for my dns server, should i add record (on the site where i bought it) # A "mi ip where my site is ?
When i do this, i must enter ns(blublublu.com or ns1.blablabla.com) in site where i bought domain blablabla.com (my site) ? It will work because
dns use 53 port, and apache use 80 port ?
Did i correctly write db.blablabla.com int /etc/bind ?
$TTL 604800
# IN SOA blablabla.com. root.blablabla.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
IN A 192.168.100.13
;
# IN NS blublublu.com. (ns.blablabla.com) ??
# IN A 192.168.100.13 ??? or there must be my static ip addresse ??
# IN AAAA ::1
ns IN A 192.168.100.13
You can use any domain. It really does not matter. The point of having a ns1.domain.com and a ns2.domain.com is the intention that ns1.domain.com is on one computer and ns2.domain.com is on another computer. That way if the computer on ns1.domain.com fails for some reason, traffic get redirected to ns2.domain.com and there was no down time for your websites. The actual domain you use can be anything as long as you own it. You also do not need to have two seperate computers, you can just point both ns1.domain.com and ns2.domain.com to the same ip, the ip of your bind server.
Where you buy your domain, you have to tell the person you bought it from that the domain is for a name-server. This is different then entering in an A record. The url, ns1.domain.com has to be entered into the authoritative name servers. Just do a search asking for setting up nameserver on your domain .100.14 //subdomain of ns2.blublublu.com, if is the same computer (not ideal) then it would be the same ip
I hope this helps the next person
So I have
mydomain.com
and I want
test.mydomain.com
Can I set this up without creating an A record for the subdomain? Either with .htaccess or
You need something in DNS. It can be an A, a CNAME, or you can use a wildcard entry like
*.mydomain.com. IN CNAME mydomain.com.
The above is a wildcard record, which will match any name under mydomain.com. You can also use a record for your specific name.
; an alias name pointing to mydomain.com
test.mydomain.com. IN CNAME mydomain.com.
; or, a regular DNS record
test.mydomain.com. IN A 1.2.3.4
Without a DNS entry, the browser will not know about your Apache instance to begin with. So you cannot solve this with .htaccess or Apache config alone, DNS must route the request to Apache first.
I would like to point CNAME records for www.example.com to sub.example2.com. The hosting for example2.com is a shared hosting (cPanel without Addon domain feature).
So, what I did was to add a subdomain in the cPanel: sub.example2.com
I then added a CNAME record for www (and without www) of example.com to sub.example2.com
After propagation, www.example.com shows the default server page of the hosting instead of showing the sub domain contents. If I access this subdomain directly, it works fine.
Can somebody help me with these, please? Thanks.
If I understood your intent correctly, you have to tell cPanel that you want to serve www.example.com, not the other thing. Either that, or create a third virtual host somewhere (anywhere) that would handle www.example.com by doing a HTTP redirect to sub.example2.com.
Note also that you can't have a CNAME record for example.com without www, because a domain record already has SOA and NS records, and CNAME can't be combined with anything else - it has to be an A record.
Another thing to know about what you're doing:
You can't use a CNAME in the zone apex
(so as in the example.com zone a record "# IN CNAME example2.com")
Theoretically it is, but in reality too many (resolving) nameservers get confused.
I am new to apache2 configuration and as far as I could determine the server setup is correct and it works fine on mydomain.com
The problem is even if I explicitly type the url www.mydomain.com, I get 301 redirect from apache to mydomain.com. I tried rewrite rules only to end up in infinite loop.
We actually want to do reverse - mydomain.com should redirect to www.mydomain.com but as indicated above, I get infinite redirect loop until browser gives up.
I have searched the configuration and could not find any mention of mydomain.com so thinking that there is some external configuration (DNS lookup?) coming into picture which is not configured correctly.
Make sure to check with the DNS server to verify you have a CNAME for www.mydomain.com
If this is for local PC (testing and development) you need to edit your host file in windows or hosts in linux.
I locally resolved the problem that I had by creating a virtual DNS server for my local network (ubuntu server).
install bind
apt-get install bind9 -y
cd /etc/bind
vim named.conf.options
And uncomment forwarders and two rows bellow and instead of 0.0.0.0 enter google's dns IP (8.8.8.8).
service bind9 restart
vim named.conf.options
zone "YOURDOMAIN NAME" {
type master;
file "db.site.com";
notify yes;
};
cp db.local /var/cache/bind/db.site.com
cd /var/cache/bind/
vim db.sajt1.rs
$TTL 604800
# IN SOA admin. admin.itlink.edu. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
IN NS ns.YOURDOMAINNAMEHERE.
IN A 192.168.1.10 replace this with the IP of your PC that has apache installed
ns A 192.168.1.10 replace this with the IP of your PC that has apache installed
www A 192.168.1.10 replace this with the IP of your PC that has
service bind9 restart
If you put the IP of the ubuntu server as your dns everything will function properly (since all sites that cant be resolved will be sent to google DNS and it will do it for you).
But this is for local network only.