connect-domain

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Connect a domain

连接域名

Get a domain serving a Hostinger website over HTTPS. The one rule that matters most: records that already work — email (
MX
), SPF, DKIM and verification
TXT
records — must survive every DNS change.
让域名通过 HTTPS 提供 Hostinger 网站服务。最重要的一条规则是:已经正常工作的记录——邮件(
MX
)、SPF、DKIM 和验证
TXT
记录——必须在每次 DNS 更改后都保留下来。

Calling the operations

调用操作

  • Read the
    inputSchema
    that
    search
    returns before the first call of each operation. If a name below is rejected as unknown,
    search
    for what the step does (e.g. "dns records").
  • Batch reads with
    multi-execute
    ; values pass between steps as
    $steps.<i>.<path>
    . Batches chain operations from one server only — the Hostinger Connector runs
    hosting
    ,
    agency-hosting
    ,
    domains
    and
    dns
    as separate servers. When
    search
    cannot find an operation, ask the user to enable that product group in the Connector.
  • Every write here changes what the public sees. State the change and get a yes before each one.
  • 在每种操作第一次调用前,读取
    search
    返回的
    inputSchema
    。如果下面的某个名称被判定为未知名称,请通过
    search
    查找该步骤对应的功能(例如
    dns records
    )。
  • 使用
    multi-execute
    批量读取;值通过
    $steps.<i>.<path>
    在步骤之间传递。批次只能串联来自同一服务器的操作——Hostinger Connector 将
    hosting
    、
    agency-hosting
    、
    domains
    和
    dns
    作为独立服务器运行。当
    search
    无法找到某个操作时,请用户启用 Connector 中对应的产品组。
  • 这里的每次写入都会改变公网可见的结果。每次写入前都要说明变更并获得用户确认。

1. Gather the facts (read-only)

1. 收集信息(只读)

  • Website.
    hosting_websites_list
    with
    domain
    (Shared and Cloud; substring match, so take the exact entry) and
    agency-hosting_websites_list-plan
    with
    domain
    (Agency). Keep
    username
    and
    order_id
    , or
    details.uid
    and
    details.ipv4
    . When the domain has no website yet, find the site the user means — often a
    *.hostingersite.com
    one — or the order to create it on (
    hosting_orders_list
    ,
    agency-hosting_orders_list
    ).
  • Registration.
    domains_portfolio_get
    succeeds only for domains registered at Hostinger; its
    name_servers
    show who runs DNS. Hostinger's own nameservers end in
    dns-parking.com
    .
  • Live DNS, to know what must be kept:
bash
dig +short NS DOMAIN; dig +short A DOMAIN; dig +short CNAME www.DOMAIN
dig +short MX DOMAIN; dig +short TXT DOMAIN; dig +short CAA DOMAIN
  • 网站。 使用
    domain
    调用
    hosting_websites_list
    (Shared 和 Cloud;支持子字符串匹配,因此要选择准确条目),并使用
    domain
    调用
    agency-hosting_websites_list-plan
    (Agency)。保留
    username
    和
    order_id
    ,或者
    details.uid
    和
    details.ipv4
    。当域名还没有关联网站时,找出用户所指的网站——通常是
    *.hostingersite.com
    网站——或用于创建网站的订单(
    hosting_orders_list
    、
    agency-hosting_orders_list
    )。
  • 注册信息。
    domains_portfolio_get
    仅对在 Hostinger 注册的域名成功;其
    name_servers
    表明由谁管理 DNS。Hostinger 自有的 nameserver 以
    dns-parking.com
    结尾。
  • 实时 DNS,用于确定必须保留的内容:
bash
dig +short NS DOMAIN; dig +short A DOMAIN; dig +short CNAME www.DOMAIN
dig +short MX DOMAIN; dig +short TXT DOMAIN; dig +short CAA DOMAIN

2. Attach the domain to hosting

2. 将域名绑定到虚拟主机

Shared and Cloud:
  • New website on the domain. For a domain outside this account run
    hosting_domains_verify-ownership
    first. When
    is_accessible
    is false, give the user the
    TXT
    record it returns to add next to the existing ones, then verify again (propagation takes up to ~10 minutes). Create with
    hosting_websites_create
    (
    domain
    without
    www.
    ,
    order_id
    ), then poll
    hosting_websites_list-setups
    with
    domain
    every 10–15 s until
    status: completed
    .
  • Moving a site off its free subdomain. Shared and Cloud websites cannot be renamed through the API. Either create a website on the real domain and redeploy the project there (the
    deploy-to-hosting
    skill) — required for WordPress, which keeps its URL in the database — or, for static sites, park the domain on the existing site with
    hosting_domains_create-website-parked
    .
  • Alias (a second domain showing the same site):
    hosting_domains_create-website-parked
    .
  • Subdomain (
    shop.example.com
    ):
    hosting_domains_create-website-subdomain
    .
    www
    belongs to the main domain — do not create it as a subdomain.
Agency Plan:
  • agency-hosting_domains_link-to-website
    adds a domain to the site.
  • agency-hosting_domains_change-website
    replaces the primary domain, for example the free subdomain. The old name stops serving at once — confirm first.
Shared 和 Cloud:
  • 在域名上创建新网站。 对于不属于此账户的域名,先运行
    hosting_domains_verify-ownership
    。当
    is_accessible
    为 false 时,将它返回的
    TXT
    记录交给用户,让用户将其添加到现有记录旁边,然后再次验证(传播最多约需 10 分钟)。使用
    hosting_websites_create
    创建网站(
    domain
    不带
    www.
    ,并提供
    order_id
    ),然后每隔 10–15 秒使用
    domain
    轮询
    hosting_websites_list-setups
    ,直到
    status: completed
    。
  • 将网站从免费子域名迁移。 Shared 和 Cloud 网站无法通过 API 重命名。可以选择使用
    deploy-to-hosting
    skill 在真实域名上创建网站并重新部署项目——WordPress 必须采用此方式,因为它会在数据库中保存 URL;或者,对于静态站点,使用
    hosting_domains_create-website-parked
    将域名停放到现有网站上。
  • 别名(使用第二个域名显示同一个网站):
    hosting_domains_create-website-parked
    。
  • 子域名(
    shop.example.com
    ):
    hosting_domains_create-website-subdomain
    。
    www
    属于主域名——不要将其创建为子域名。
Agency 套餐:
  • agency-hosting_domains_link-to-website
    将域名添加到网站。
  • agency-hosting_domains_change-website
    替换主域名,例如替换免费子域名。旧名称会立即停止提供服务——必须先确认。

3. Point DNS at Hostinger

3. 将 DNS 指向 Hostinger

DNS already at Hostinger (nameservers end in
dns-parking.com
): creating the website normally writes the records. Read the zone with
dns_records_list
; when
@
and
www
already point at the site, change nothing. Before any edit, note the newest
dns_snapshots_list
entry —
dns_snapshots_restore
rolls back to it.
dns_records_update
defaults to
overwrite: true
, which deletes every existing record with the same name and type. Adding a
TXT
at
@
that way wipes SPF and verification records. Send
overwrite: false
when adding; use
true
only to replace one record set on purpose, and run
dns_records_validate
on the same payload first.
DNS elsewhere (registered at Hostinger with other nameservers, or registered elsewhere). Two options — let the user choose:
  • Switch nameservers to Hostinger. Hostinger then manages every record. First copy each record the current DNS serves beyond the website —
    MX
    ,
    TXT
    , service
    CNAME
    s — into the Hostinger zone with
    dns_records_update
    (
    overwrite: false
    ); otherwise email breaks when the nameservers flip. Hostinger's nameserver pairs differ between domains (
    ns1
    /
    ns2.dns-parking.com
    ,
    solar
    /
    lunar.dns-parking.com
    and others), so use the pair hPanel shows for this domain, never a guessed one. For Hostinger-registered domains apply it with
    domains_portfolio_update-nameservers
    ; otherwise the user changes it at their registrar.
  • Keep the current DNS provider and change only the web records:
    A
    for
    @
    and
    CNAME
    (or
    A
    ) for
    www
    . Agency sites point at
    details.ipv4
    . Shared and Cloud sites point at the targets in the Hostinger zone for the domain (
    dns_records_list
    ) or, when that zone does not exist, the IP hPanel shows for the website. The user makes this change at their DNS provider.
DNS 已在 Hostinger(nameserver 以
dns-parking.com
结尾):创建网站时通常会自动写入记录。使用
dns_records_list
读取 DNS 区域;当
@
和
www
已经指向该网站时,不做任何更改。编辑前,记下最新的
dns_snapshots_list
条目——
dns_snapshots_restore
可回滚到该条目。
dns_records_update
默认使用
overwrite: true
,这会删除所有名称和类型相同的现有记录。如果以这种方式在
@
处添加
TXT
,就会清除 SPF 和验证记录。添加记录时应传入
overwrite: false
;仅在有意替换某组记录时使用
true
,并先用相同的负载运行
dns_records_validate
。
DNS 在其他位置(域名在 Hostinger 注册但使用其他 nameserver,或在其他服务商注册):有两种选择——让用户选择:
  • 将 nameserver 切换到 Hostinger。 随后由 Hostinger 管理所有记录。首先将当前 DNS 提供的、除网站之外的所有记录——
    MX
    、
    TXT
    、服务
    CNAME
    ——使用
    dns_records_update
    (
    overwrite: false
    )复制到 Hostinger 区域;否则切换 nameserver 时邮件会中断。Hostinger 的 nameserver 配对因域名而异(
    ns1
    /
    ns2.dns-parking.com
    、
    solar
    /
    lunar.dns-parking.com
    等),因此必须使用 hPanel 为该域名显示的配对,绝不能猜测。对于在 Hostinger 注册的域名,使用
    domains_portfolio_update-nameservers
    应用更改;对于在其他服务商注册的域名,则由用户在其注册商处更改。
  • 保留当前 DNS 服务商,只更改网站记录:为
    @
    设置
    A
    记录,为
    www
    设置
    CNAME
    (或
    A
    )记录。Agency 网站指向
    details.ipv4
    。Shared 和 Cloud 网站指向 Hostinger 区域中该域名的目标(
    dns_records_list
    );如果该区域不存在,则指向 hPanel 为该网站显示的 IP。变更由用户在 DNS 服务商处完成。

4. SSL and HTTPS

4. SSL 和 HTTPS

Start only once
dig
shows the domain resolving to Hostinger — the certificate authority checks the domain against the server.
  • Shared and Cloud:
    hosting_ssl_status
    . When it is not
    active
    , call
    hosting_ssl_install
    and poll the status until
    active
    (or
    failed
    with
    last_error
    ), then
    hosting_ssl_toggle-https-redirect
    with
    is_enabled: true
    (it returns 422 until a certificate exists).
  • Agency:
    agency-hosting_ssl_install-website
    for each domain, then poll
    agency-hosting_ssl_website-status
    . A domain allows three setups per seven days and one request a minute — install once DNS is right and never loop.
  • A
    CAA
    record at the apex that does not allow
    letsencrypt.org
    blocks issuance; the user adds
    0 issue "letsencrypt.org"
    beside the existing ones.
只有在
dig
显示域名已解析到 Hostinger 后才能开始——证书颁发机构会检查域名是否指向该服务器。
  • Shared 和 Cloud:使用
    hosting_ssl_status
    。当状态不是
    active
    时,调用
    hosting_ssl_install
    并轮询状态,直到变为
    active
    (或者变为
    failed
    并提供
    last_error
    ),然后调用
    hosting_ssl_toggle-https-redirect
    并设置
    is_enabled: true
    (在证书存在之前,该调用会返回 422)。
  • Agency:对每个域名调用
    agency-hosting_ssl_install-website
    ,然后轮询
    agency-hosting_ssl_website-status
    。每个域名允许每 7 天设置 3 次,并且每分钟只能请求 1 次——DNS 配置正确后安装一次,切勿循环调用。
  • 根域名处的
    CAA
    记录如果不允许
    letsencrypt.org
    ,就会阻止证书签发;用户需要在现有记录旁添加
    0 issue "letsencrypt.org"
    。

5. Verify

5. 验证

bash
dig +short A DOMAIN; dig +short A www.DOMAIN
curl -sSI https://DOMAIN/ | grep -i -E "^(HTTP|platform|location)"
curl -sSI http://DOMAIN/ | grep -i -E "^(HTTP|location)"
dig +short MX DOMAIN
Done when both names resolve to Hostinger, HTTPS answers with
platform: hostinger
, HTTP redirects to HTTPS, and
MX
still matches step 1. Nameserver changes can take up to 24–48 hours to reach every resolver; when records are still old, report what is pending and the command to re-check instead of polling for hours.
bash
dig +short A DOMAIN; dig +short A www.DOMAIN
curl -sSI https://DOMAIN/ | grep -i -E "^(HTTP|platform|location)"
curl -sSI http://DOMAIN/ | grep -i -E "^(HTTP|location)"
dig +short MX DOMAIN
完成条件:两个名称都解析到 Hostinger,HTTPS 响应包含
platform: hostinger
,HTTP 重定向到 HTTPS,且
MX
仍与第 1 步一致。nameserver 更改可能需要 24–48 小时才能传播到所有解析器;当记录仍是旧值时,应报告仍在等待的内容和重新检查所用的命令,而不是持续轮询数小时。