Mac Os Server,如何使 bind 点 www.mydomain.com 指向安装 bind 的同一台机器?

Mac Os Server,如何使 bind 点 www.mydomain.com 指向安装 bind 的同一台机器?

我想将我的服务器的 IP 设置为 DNS,然后能够使 myproject.com、www.myproject.com 和 *.applications.com 等域名指向我将在 apache 中托管这些文件的同一台服务器。

我安装了 macports,这是我的配置文件:/opt/local/etc/named.conf

    // Declares control channels to be used by the rndc utility.
    //
    // This must be enabled on Mac OS X Server for Server Status to provide valid
    // information! (Remove the leading slashes to enable.)
    //
    //        **** STUFF YOU MIGHT NEED TO ENABLE ****
    //
     controls {
          unix "/var/run/ndc" perm 0600 owner 0 group 0;
          inet 127.0.0.1 port 54 allow {any; };
     };
    // It is recommended that 127.0.0.1 be the only address used.
    // This also allows non-privileged users on the local host to manage
    // your name server.

    options {
            directory "/opt/local/var/named";

            // uncomment the following lines to turn on DNS forwarding,
            // and change the forwarind ip address(es) :
            //forward first;
            //forwarders {
            //      123.123.123.123
            //      123,123.123.123;
            //};

            listen-on-v6 { none; };
            listen-on { 127.0.0.1; };

            // to allow only specific hosts to use the DNS server:
            //allow-query {
            //      127.0.0.1;
            //};

            dnssec-validation auto;
            pid-file "/opt/local/var/run/named.pid";
    };

    //
    // a caching only nameserver config

    zone "." IN {
            type hint;
            file "db.cache";
    };

    zone "localhost" IN {
            type master;
            file "db.localhost";
            allow-update { none; };
    };

    zone "0.0.127.in-addr.arpa" IN {
            type master;
            file "db.127.0.0";
            allow-update { none; };
    };

所以我想让所有这些都指向安装了 bind 的同一台服务器:

www.myproject.com
myproject.com
*.applications.com

我该怎么做?我还想问一下如何才能找到关于 bind 的优秀文档或书籍。我在网上找到的文档要么太技术性,要么太简单。

或者是否有更简单的界面来使用 bind?

答案1

您需要编辑 named.conf 来添加区域,例如:

zone "myproject.com" IN {
    type master;
    file "myproject.com.zone";
    allow-update { none; };
}

/opt/local/var/named然后在named中创建区域文件myproject.com.zone。该文件应如下所示:

$ORIGIN myproject.com.
$TTL 21600 
@                      3600 SOA   <your ns A record>. (
                              sysadmins.stackoverflow.com.    ; address of responsible party
                              2011072601                          ; serial number
                              3600                       ; refresh period
                              600                        ; retry period
                              604800                     ; expire time
                              60                       ) ; minimum ttl
                                NS    <YOUR_NS_A_RECORD>.

                                A     <YOUR_IP>
*               IN      A     <YOUR_IP>

通配符是你最好的选择,因为你不必再担心它。

我强烈建议您获取一份DNS 和 BIND

答案2

这是区域文件中对我有用的内容,我使用了 Zypher 在 named.conf 中建议的内容

$TTL 10800
myproject.com. IN SOA myservername.myproject.com. admin.mymyproject.com. (
    2011071800  ;Serial
    86400       ;Refresh
    3600        ;Retry
    604800      ;Expire
    345600      ;Negative caching TTL
 ) 

www.projects.com. IN  A <SERVER IP>
projects.com. IN  NS myservername.myproject.com. 
projects.com. IN  A <SERVER IP> 
www IN  CNAME myproject.com. 

相关内容