使用 BIND 和 Lighttpd(Vhosts)在 Centos 服务器上设置子域名

使用 BIND 和 Lighttpd(Vhosts)在 Centos 服务器上设置子域名

我有点束手无策了。我正尝试在网络上的主机上设置子域。

我的计算机在内部网络上的 ged12345.dev.example.internal。这很好用,但我正在尝试设置插件子域 (plugins.ged12345.dev.example.internal) 以重定向到服务器上的目录。

这是我的 /etc/lighttpd/lighttpd.conf 文件的相关部分:

$HTTP["host"] == "plugins.ged12345.dev.example.internal" {
    server.document-root = "/var/www/lighttpd/plugins.ged12345.dev.example.internal/http2"
    server.errorlog = "/var/log/lighttpd/plugins.ged12345.dev.example.internal/error2.log"
    accesslog.filename = "/var/log/lighttpd/plugins.ged12345.dev.example.internal/access2.log"
}

$HTTP["host"] == "ged12345.dev.example.internal" {
    server.document-root = "/var/www/lighttpd/plugins.ged12345.dev.example.internal/http"
    server.errorlog = "/var/log/lighttpd/plugins.ged12345.dev.example.internal/error.log"
    accesslog.filename = "/var/log/lighttpd/plugins.ged12345.dev.example.internal/access.log"
}

现在,我已确认底部主机设置有效,但顶部子域无效。然后一位朋友建议我可能需要设置 Bind 才能正确解析名称。现在,我无法控制网络上的名称服务器。据我所知,我仍然可以使用 bind 正确解析到我的插件子域。我假设请求转到名称服务器,然后转发到 Bind 来解析地址,但当我使用 nslookup 时,我找不到 plugins.ged12345.dev.example.internal。

我需要 Bind 吗?或者这个主机设置(基本上是虚拟主机)可以解决所有问题吗?如果您能提供任何帮助或指导,我将非常感激,因为我非常迷茫。

这是我的named.conf:

options {
       listen-on port 53 { 127.0.0.1; 10.2.3.205;};
       #       listen-on-v6 port 53 { ::1; };
       directory       "/var/named";
    dump-file       "/var/named/data/cache_dump.db";
    statistics-file "/var/named/data/named_stats.txt";
    memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { any; };
    #recursion yes;

    dnssec-enable yes;
    dnssec-validation yes;
    dnssec-lookaside auto;

    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";
 managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "ged12345.dev.example.internal" IN {
        type master;
        file "ged12345.dev.example.internal.zone";
        allow-update { none; };
};

zone "6.2.10.in-addr.arpa" IN {
        type master;
        file "ged12345.dev.example.internal.revzone";
        allow-update { none; };
};


include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

这是我的区域文件(ged12345.dev.example.internal.one)

TTL 86400
@   IN  SOA     vip-dns.prod.example.internal. ged12345.dev.example.internal. (
        2013042207  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
; Specify our two nameservers
                IN      NS              vip-dns.prod.example.internal.
vip-dns         IN      A               10.3.2.205
; Define hostname -> IP pairs which you wish to resolve
client          IN      A               10.2.6.52
www             IN      CNAME           client
plugins         IN      CNAME           client

这是我的反向区域文件(ged12345.dev.example.internal.revzone):

$TTL 86400
@   IN  SOA     vip-dns.prod.example.internal. ged12345.dev.example.internal. (
        3013042211  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)

@                IN      NS             vip-dns.prod.example.internal.
; Define hostname -> IP pairs which you wish to resolve
52              IN      PTR             ged12345.dev.example.internal.
205             IN      PTR             vip-dns.prod.example.internal.
52              IN      PTR             plugins.ged12345.dev.example.internal.

相关内容