Hi

I want to have a server without any control panel(as they will install apache and other modules).I have install php and nginx successfully.However how to add my domain dns zone via ssh
Also by default nginx document root is /usr/share/nginx/html/ . I have no problem with that as i will host only 1 domain on my dedicated server.

Can anyone of you be generous enough to give me step by step instruction on how to add the domain dns zone and set document root to /usr/share/nginx/html/ so that when i go to http://mydomain.com/ , my site loads fine
My OS - Centos 6 Minimal
No Control Panel
SSH access available

Use these in your explaination
Nameservers
ns1.site.com
ns2.site.com
Server uses BIND
REally looking forward to solve this asap
Thanks a ton in advance

Dani AI

Generated

Quick, practical summary and a minimal checklist that fills the gaps left in the thread (symptom: www worked but the bare domain did not). As observed, that usually means the zone had no A record for the apex (the “@” / root name). For a CentOS 6 server running BIND and nginx, the reliable sequence is: create a proper zone file with an A record for the apex, add the zone to /etc/named.conf, validate with BIND tools, make sure registrar glue/host records exist for ns1/ns2 (if those names point to the same box), open port 53 in the firewall, then confirm DNS with dig and configure nginx to answer for both names.

Example zone file (replace mydomain.com and the example IPs with real values):

$TTL 86400
@   IN SOA  ns1.site.com. hostmaster.mydomain.com. (
        2026012801 ; serial YYYYMMDDNN
        3600       ; refresh
        1800       ; retry
        604800     ; expire
        86400 )    ; minimum

    IN NS   ns1.site.com.
    IN NS   ns2.site.com.

ns1 IN A    203.0.113.10
ns2 IN A    203.0.113.11

@   IN A    203.0.113.10
www IN CNAME mydomain.com.

Add a zone stanza to /etc/named.conf (zone name = actual domain), then validate and reload:

named-checkconf
named-checkzone mydomain.com /var/named/mydomain.com.zone
service named restart
chkconfig named on

Notes and troubleshooting: do not make the zone apex a CNAME (CNAME at the apex conflicts with SOA/NS). If using custom nameservers inside the same domain, create glue/host records at the registrar for ns1/ns2 → IP. Open UDP/TCP port 53 in iptables and, if SELinux is enforcing, ensure the zone file has the proper context (restorecon). Use dig (for example dig @ns1.site.com mydomain.com A) and check /var/log/messages for named errors. Finally, configure an nginx server block that lists both mydomain.com and www.mydomain.com and points root to /usr/share/nginx/html, then reload nginx.

Recommended Answers

All 3 Replies

uPDATE:
www version of site loads fine but non www version don't load @ all
You have forgotten to create a A record for @
This is the answer i got from serverfault(site is in read only now due to maintenance)
What he mean by add a A record for @ can anyone give me a example
Also what files shall i edit to add this A record
Referance
http://serverfault.com/questions/416564/non-www-version-of-site-not-loading

The 'A record for @' means you didn't define the primary domain (you defined a subdomain, which could be a different machine, so you must be specific...)

I usually set my A record without www.
then make CNAME records for the www, mail, ftp or whatever. (CNAME are basically registered aliases for your A records). A records help split a domain over multiple machines.

You might want to use command 'dig' to lookup 'yourdomain.com' and 'www.yourdomain.com', and make sure they both resolve to your IP.

If they are both resolving, your problem may not be DNS, but with nginx.

Problem was with dns
Fixed:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.