首页 文章

将域名链接到服务器[关闭]

提问于
浏览
0

所以我第一次钻研没有控制面板运行服务器的世界,通过终端做所有事情,偶尔登录桌面gui,如果需要的话 .

据我所知,我几乎所有工作都在工作,防火墙很麻烦,但我想我现在已经搞定了 .

我无法解决的最后一件事是如何让我购买的域名正确指向我的服务器(我总是通过控制面板完成此操作,然后自动化大部分) .

这些是我到目前为止所采取的步骤(这些可能是错的,我一直在谷歌搜索疯狂的事情,但到处都告诉我做一些不同的事情,所以如果出现问题请告诉我) .

  • 购买名称名称,例如"mydomain.com"

  • 让服务器运行Ubuntu 64位 . IP地址,例如"1.2.3.4"

  • 主机为我提供了3个“DNS解析器”,例如:“1.1.1.1”,“1.1.1.2”,“1.1.1.3”

  • 我在我的服务器上设置了主机名

  • 在终端输出中运行"hostname": mydomain

  • 检查/ etc / hostname输出: mydomain.com

  • 我已将这3个DNS解析器添加到我的/etc/resolv.conf文件中,如下所示:

domain mydomain.com
search mydomain.com
nameserver 1.1.1.1
nameserver 1.1.1.2
nameserver 1.1.1.3
  • 我在我的httpd.conf文件中设置了虚拟主机:
<VirtualHost 1.2.3.4:80>
ServerName mydomain.com
ServerAlias mydomain
DocumentRoot /var/www/mysite
</VirtualHost>

从现在开始,我一直在用不同的东西进行游戏 . 目前我已进入我的域名注册商面板并将三个名称服务器设置为“ns1.mydomain.com”,“ns2.mydomain.com”,“ns3.mydomain.com” .

我已经安装了webmin来尝试设置DNS区域记录,这就是我目前在各种命令的输出上得到的:

(其中1.1.1.1,1.1.1.2,1.1.1.3是那些DNS解析器)

[b] nslookup -sil localhost [/ b]

conn@duckfusion:~$ nslookup -sil localhost
;; Got SERVFAIL reply from 1.1.1.2, trying next server
;; Got SERVFAIL reply from 1.1.1.3, trying next server
;; connection timed out; no servers could be reached

[b] nslookup -sil mydomain.com [/ b]

conn@duckfusion:~$ nslookup -sil mydomain.com
;; Got SERVFAIL reply from 1.1.1.2, trying next server
;; Got SERVFAIL reply from 1.1.1.3, trying next server
;; connection timed out; no servers could be reached

这是我的“named.conf”文件:

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

[U] named.conf.options [/ U]

options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

         forwarders {
                1.1.1.1; 1.1.1.2; 1.1.1.3; 208.67.222.222; 208.67.220.220;
         };

        //========================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //========================================================================
        dnssec-validation auto;

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
        allow-query {
                any;
                };
        listen-on port 53 {
                any;
                };
};

[U] named.conf.local [/ U]

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "mydomain.com" {
        type master;
        file "/var/lib/bind/mydomain.com.hosts";
        };

[u] /var/lib/bind/mydomain.com.hosts [/ u](其中1.2.3.4是我服务器的IP)

$ttl 38400
mydomain.com. IN      SOA     mydomain.com. me.myemail.com. (
                        1366054515
                        10800
                        3600
                        604800
                        38400 )
mydomain.com. IN      NS      mydomain.com.
mydomain.com. IN      A       1.2.3.4
www.mydomain.com.     IN      A       1.2.3.4
mail.mydomain.com.    IN      A       1.2.3.4
ftp.mydomain.com.     IN      A       1.2.3.4
ns1.mydomain.com.     IN      A       1.2.3.4
ns2.mydomain.com.     IN      A       1.2.3.4
ns3.mydomain.com.     IN      A       1.2.3.4
mydomain.com. IN      NS      ns1.mydomain.com.
mydomain.com. IN      NS      ns2.mydomain.com.
mydomain.com. IN      NS      ns3.mydomain.com.
mydomain.com. IN      MX      10 mail.mydomain.com.

这就是我所拥有的 .

我显然可以通过IP地址作为URL访问服务器,但不是通过域名 .

谁能让我知道:

A)我出错的地方B)我需要做些什么来实现这个目标?

非常感谢你 .

1 回答

  • 0

    运行自己的命名是过度的,不需要 . 以下是有效设置的样子:

    • 您的网络服务器托管服务提供商(您的网站所在地)为您提供了一些DNS解析器 . 这些旨在为您的Web服务器提供DNS解析,因此它可以在Internet上找到OTHER主机 . 这些解析器与托管您的域无关,您无法更改其域定义 .

    • 您的DNS托管服务提供商拥有自己的DNS服务器,默认情况下用于托管您的DNS "A"记录 . 如果您确实重新配置了DNS托管帐户以使用Web提供商的DNS服务器,则这是一个错误 . 您无法将DNS记录添加到这些服务器 .

    • 在DNS托管服务提供商的控制面板上,首先将其设置为使用其DNS服务器;然后为您的域创建一个"A"记录,指向您的Web服务器主机的IP .

    综上所述:

    DNS Hosting Provider
        DNS Server(s) contain:
            www.yourserver.com      A     1.2.3.4
            alias.yourserver.com    CNAME www.yourserver.com (maybe)
            yourserver.com          MX    where.you.receive.mail (maybe)
    
    Web Hosting Provider
        Your web server at 1.2.3.4
            /etc/resolv.conf
                nameserver 1.1.1.1
                nameserver 1.1.1.2
                nameserver 1.1.1.3
    

    这就是您需要为其他人找到您的服务器所需的一切 .

    运行自己的DNS的唯一原因是托管整个网络,包括多台计算机,防火墙后面或托管整个C类或更多的IP地址 . 要做到这一点,你需要与其他提供商签订对等和路由协议,我认为你没有 .

    EDIT

    $ dig duckfusion.com
    
    ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 <<>> duckfusion.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32080
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 17
    
    ;; QUESTION SECTION:
    ;duckfusion.com.                        IN      A
    
    ;; ANSWER SECTION:
    duckfusion.com.         1800    IN      A       87.117.219.53
    duckfusion.com.         1800    IN      A       192.31.186.140
    
    ;; AUTHORITY SECTION:
    duckfusion.com.         172800  IN      NS      dns4.registrar-servers.com.
    duckfusion.com.         172800  IN      NS      dns5.registrar-servers.com.
    duckfusion.com.         172800  IN      NS      dns3.registrar-servers.com.
    duckfusion.com.         172800  IN      NS      dns1.registrar-servers.com.
    duckfusion.com.         172800  IN      NS      dns2.registrar-servers.com.
    

相关问题