migrate-to-hosting
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMigrate to hosting
迁移到虚拟主机
The old host keeps serving the site until the copy on Hostinger is proven to work. DNS moves last.
在 Hostinger 上的副本被证明能够正常工作之前,旧主机会继续为该站点提供服务。最后再切换 DNS。
Calling the operations
调用操作
- Read the that
inputSchemareturns before the first call of each operation. If a name below is rejected as unknown,searchfor what the step does (e.g. "import wordpress").search - Batch reads with . Batches chain operations from one server only — the Hostinger Connector runs
multi-execute,hosting,wordpress,agency-hostinganddomainsas separate servers.dns - Imports and deploys overwrite the target website's contents; confirm the target before each one.
- 在首次调用每个操作之前,读取 返回的
search。如果下面的某个名称被判定为未知,请通过inputSchema查询该步骤的作用(例如 "import wordpress")。search - 使用 批量读取。批次只能串联同一服务器上的操作——Hostinger Connector 将
multi-execute、hosting、wordpress、agency-hosting和domains作为独立服务器运行。dns - 导入和部署会覆盖目标网站的内容;每次执行前都要确认目标。
1. What is being moved
1. 要迁移的内容
Establish, asking only for what cannot be inferred:
- Site type: WordPress, static, PHP (with or without MySQL), or Node.js.
- The export:
- WordPress — an archive of the whole WordPress root (including and
wp-content) and awp-config.phpdump..sql - PHP — a files archive, plus a dump when the app has a database.
.sql - Static — the files. Node.js — the source or its Git repository.
- Without one, the user exports it from the old host's panel, or over SSH: and
tar -czf site.tar.gz -C /path/to/site ..mysqldump --single-transaction -u USER -p DBNAME > db.sql
- WordPress — an archive of the whole WordPress root (including
- The exact home URL (, with or without
https) — WordPress keeps it in the database, so the new site must answer on the same one.www - Current DNS, to preserve what already works:
bash
dig +short NS DOMAIN; dig +short A DOMAIN; dig +short MX DOMAIN; dig +short TXT DOMAIN- Cron jobs on the old host — they do not move with the files.
先确定以下信息,仅询问无法推断的部分:
- 站点类型: WordPress、静态站点、PHP(有无 MySQL 均可)或 Node.js。
- 导出内容:
- WordPress——整个 WordPress 根目录的归档(包含 和
wp-content)以及一个wp-config.phpdump。.sql - PHP——文件归档;如果应用包含数据库,还需要一个 dump。
.sql - 静态站点——文件。Node.js——源代码或其 Git 仓库。
- 如果没有导出文件,用户需从旧主机的控制面板导出,或通过 SSH 执行:和
tar -czf site.tar.gz -C /path/to/site .。mysqldump --single-transaction -u USER -p DBNAME > db.sql
- WordPress——整个 WordPress 根目录的归档(包含
- 准确的主页 URL(,带或不带
https)——WordPress 会将其保存在数据库中,因此新站点必须响应同一个 URL。www - 当前 DNS 配置,以保留已经可用的设置:
bash
dig +short NS DOMAIN; dig +short A DOMAIN; dig +short MX DOMAIN; dig +short TXT DOMAIN- 旧主机上的 Cron jobs——不会随文件一起迁移。
2. Create the website on the real domain
2. 在正式域名上创建网站
Create the Hostinger website on the domain being migrated, not on a free subdomain: step 4 tests it by pointing only this machine at Hostinger, so nothing changes for visitors yet.
- Shared and Cloud: first. When
hosting_domains_verify-ownershipis false, the user adds the returnedis_accessiblerecord at their current DNS provider, next to the existing ones, and verification is repeated. ThenTXTwithhosting_websites_createanddomain(fromorder_id), and pollhosting_orders_listwithhosting_websites_list-setupsevery 10–15 s untildomain.status: completed - Agency: with the
agency-hosting_website-setups_create,domain, aflavor: "php-fpm"matching the old host (options insettings.php.version) andagency-hosting_php_list-versions-for-orderfromdatacenter_code. Pollagency-hosting_datacenters_listuntilagency-hosting_website-setups_statusfor thecompleted.website_uid
在要迁移的域名下创建 Hostinger 网站,而不是使用免费子域名:第 4 步只会让当前机器指向 Hostinger 来进行测试,因此此时访客看到的内容不会发生变化。
- Shared 和 Cloud:首先执行 。当
hosting_domains_verify-ownership为 false 时,用户需在当前 DNS 服务商处添加返回的is_accessible记录,并将其放在现有记录旁边,然后再次执行验证。接着使用TXT和domain(来自order_id)调用hosting_orders_list,并每 10–15 秒使用hosting_websites_create轮询domain,直至hosting_websites_list-setups。status: completed - Agency:使用 、
domain、与旧主机匹配的flavor: "php-fpm"(选项来自settings.php.version)以及来自agency-hosting_php_list-versions-for-order的agency-hosting_datacenters_list调用datacenter_code。随后针对agency-hosting_website-setups_create轮询website_uid,直至agency-hosting_website-setups_status。completed
3. Import
3. 导入
hosting_deploypathagency-hosting_deploy-php-applicationhostinger-api-mcphosting_deploymcp.hostinger.comdeploy-to-hostingWordPress, Shared and Cloud: with , (the site directory or its archive), and uploads both, extracts the files and imports the database; large sites take several minutes. Always pass : left to detection, a directory without or at its top level is taken for a plain site and the dump is not imported. [Upload and , then with and .] Then with and poll with until the install appears with .
hosting_deploydomainpathdatabaseDumptype: "wordpress-site"typewp-config.phpwp-contentsite.zipdump.sqlwordpress_installations_import-websitearchive_pathsql_pathwordpress_installations_detectusernamewordpress_installations_listdomainis_valid: trueStatic, or PHP without a database: with and [upload, then ]; Agency: [upload to , then ].
hosting_deploydomainpathhosting_websites_deploy-static-site-archiveagency-hosting_deploy-php-application.h5g/agency-hosting_files_import-website-from-archivePHP with a database, Shared and Cloud:
- with a strong generated password; read the full name, user and
hosting_databases_createback fromhost.hosting_databases_list - Import the dump from this machine: allow only its public IP () with
curl -s https://api.ipify.org, runhosting_databases_create-remote-connection, then remove the rule withmysql -h HOST -u USER -p NAME < db.sql. Without a MySQL client, usehosting_databases_delete-remote-connectionand import there.hosting_databases_phpmyadmin-link - Put the new name, user and password into the app's config file, with host , before archiving; then deploy as above. Never ship the
localhosthost inside the app.srvNNNN.hstgr.io
Node.js: deploy with the skill. When a dump must be imported, create the database with rather than — the latter never reveals the password needed for the import — and pass the credentials through environment variables.
deploy-to-hostinghosting_databases_createhosting_databases_setup-websiteAgency: files with [or upload plus ]; the database with , imported through phpMyAdmin in hPanel (no import operation exists). For WordPress, set the new credentials in before archiving.
agency-hosting_deploy-php-applicationagency-hosting_files_import-website-from-archiveagency-hosting_databases_create-websitewp-config.php带 参数的 和 会从当前机器读取文件,因此这些文件只存在于本地 服务器上;托管服务器上的 只能部署 Git 仓库。在托管服务器()上,应先按照 skill 中(“Without the local deploy operations”)的说明上传文件,然后使用下文方括号中注明的操作。
pathhosting_deployagency-hosting_deploy-php-applicationhostinger-api-mcphosting_deploymcp.hostinger.comdeploy-to-hostingWordPress,Shared 和 Cloud: 使用 、(站点目录或其归档)、 和 调用 ,即可上传这两项、解压文件并导入数据库;大型站点可能需要数分钟。务必始终传入 :若交给自动检测,顶层不含 或 的目录会被视为普通站点,且不会导入 dump。[上传 和 ,然后使用 和 调用 。] 接着使用 调用 ,并使用 轮询 ,直到安装记录出现且 。
domainpathdatabaseDumptype: "wordpress-site"hosting_deploytypewp-config.phpwp-contentsite.zipdump.sqlarchive_pathsql_pathwordpress_installations_import-websiteusernamewordpress_installations_detectdomainwordpress_installations_listis_valid: true静态站点,或无数据库的 PHP: 使用 和 调用 [上传后调用 ];Agency:使用 [上传至 后调用 ]。
domainpathhosting_deployhosting_websites_deploy-static-site-archiveagency-hosting_deploy-php-application.h5g/agency-hosting_files_import-website-from-archive带数据库的 PHP,Shared 和 Cloud:
- 使用 创建数据库并设置强生成密码;从
hosting_databases_create中读取数据库完整名称、用户和hosting_databases_list。host - 从当前机器导入 dump:使用 仅允许当前机器的公共 IP(
hosting_databases_create-remote-connection)访问,运行curl -s https://api.ipify.org,然后使用mysql -h HOST -u USER -p NAME < db.sql删除该规则。如果没有 MySQL 客户端,则使用hosting_databases_delete-remote-connection并在其中导入。hosting_databases_phpmyadmin-link - 在归档前,将新的数据库名称、用户和密码写入应用配置文件,并将 设置为
host;然后按上述方式部署。切勿在应用中写入localhost主机地址。srvNNNN.hstgr.io
Node.js: 使用 skill 部署。如果必须导入 dump,请使用 创建数据库,而不要使用 ——后者不会显示导入所需的密码——并通过环境变量传递凭据。
deploy-to-hostinghosting_databases_createhosting_databases_setup-websiteAgency: 文件使用 [或先上传,再调用 ];数据库使用 ,并通过 hPanel 中的 phpMyAdmin 导入(不存在导入操作)。对于 WordPress,请在归档前将新凭据写入 。
agency-hosting_deploy-php-applicationagency-hosting_files_import-website-from-archiveagency-hosting_databases_create-websitewp-config.php4. Test before DNS moves
4. 在切换 DNS 前进行测试
Find the server address: for Agency; for Shared and Cloud, the record for in the Hostinger zone ( on the domain) or the IP hPanel shows for the website. Then point only this machine at it:
details.ipv4A@dns_records_listbash
curl -sSk --resolve DOMAIN:443:IP -o /dev/null -w "%{http_code}\n" https://DOMAIN/
curl -sSk --resolve DOMAIN:443:IP https://DOMAIN/ | grep -o "TEXT FROM THE LIVE SITE"
curl -sSk --resolve DOMAIN:443:IP -o /dev/null -w "%{http_code}\n" https://DOMAIN/wp-login.php-kIP DOMAIN www.DOMAIN查找服务器地址:Agency 使用 ;Shared 和 Cloud 使用 Hostinger DNS 区域中 的 记录(在域名上执行 ),或使用 hPanel 显示的网站 IP。然后只让当前机器指向该地址:
details.ipv4@Adns_records_listbash
curl -sSk --resolve DOMAIN:443:IP -o /dev/null -w "%{http_code}\n" https://DOMAIN/
curl -sSk --resolve DOMAIN:443:IP https://DOMAIN/ | grep -o "TEXT FROM THE LIVE SITE"
curl -sSk --resolve DOMAIN:443:IP -o /dev/null -w "%{http_code}\n" https://DOMAIN/wp-login.php这里使用 是预期现象:域名的证书只能在 DNS 切换后签发。检查主页、内部页面;对于 WordPress,还要检查登录页面。若想在浏览器中查看,用户可在 hosts 文件中添加 ,并在完成后将其删除。现在修复所有问题,此时访客看到的仍是旧站点。
-kIP DOMAIN www.DOMAIN5. Switch DNS and SSL
5. 切换 DNS 和 SSL
Follow the skill from its DNS step: keep every and record from step 1, then install SSL once the domain resolves to Hostinger. When the user controls the old DNS, lowering the TTL of the records to 300 a day ahead shortens the switch.
connect-domainMXTXTA从 DNS 步骤开始遵循 skill:保留第 1 步中的每一条 和 记录,然后在域名解析到 Hostinger 后安装 SSL。如果用户控制旧 DNS,可提前一天将 记录的 TTL 降至 300,以缩短切换时间。
connect-domainMXTXTA6. After the switch
6. 切换后
- Verify without :
--resolveshowscurl -sSI https://DOMAIN/.platform: hostinger - Recreate the old host's cron jobs with (Agency:
hosting_cron-jobs_create).agency-hosting_cron-jobs_create-website - Keep the old hosting running for a few days — some resolvers still cache the old address, and email hosted there must be moved separately.
- 不使用 进行验证:
--resolve应显示curl -sSI https://DOMAIN/。platform: hostinger - 使用 重新创建旧主机上的 Cron jobs(Agency:
hosting_cron-jobs_create)。agency-hosting_cron-jobs_create-website - 让旧托管服务继续运行几天——部分 DNS 解析器仍会缓存旧地址,且旧主机上的电子邮件需要单独迁移。