You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

主服务器域名切换域名服务器(Nameservers)技术咨询

Hey there, let’s break down how to pull off your site migration smoothly given your specific setup with WHM/cPanel and a domain registered at Fasthosts. I’ve dealt with tons of similar scenarios, so here’s a step-by-step guide with key checks to avoid headaches:

1. First, Validate Your Custom Nameservers

Before diving into migration, make sure your custom NS records are actually working—this is a common pain point when using external domain registrars:

  • Verify that ns1.example.com and ns2.example.com point directly to your WHM server (whm.example.com) IP. Run these commands in your terminal to confirm:
    dig ns1.example.com A +short
    dig ns2.example.com A +short
    
    Both should return the exact public IP of whm.example.com. If not, head back to WHM’s DNS Zone Editor for example.com and fix the A records for your NS entries.
  • Double-check Fasthosts’ domain settings: Ensure you’ve fully replaced their default nameservers with ns1.example.com and ns2.example.com—no leftover old NS records allowed here.
2. Backup Everything (Don’t Skip This!)

Migration can go sideways, so cover your bases:

  • Full cPanel Account Backup: Log into WHM, navigate to Backup > Backup User Accounts, select the accounts you’re migrating, and choose a full backup (includes files, databases, emails, and settings). Save it locally or to a secure external storage—don’t rely solely on server-side backups.
  • Separate Database Export: For extra safety, export each site’s database via cPanel’s phpMyAdmin: Select the database, click Export, pick the Quick mode, and save the SQL file to your computer. This gives you a fallback if the full backup has issues.
3. Migrate Your Sites (Two Reliable Methods)

Option 1: Use WHM’s Transfer Tool (Best for cPanel-to-cPanel)

This is the easiest route if your source server is also running WHM/cPanel:

  1. In WHM, go to Transfers > Transfer Tool
  2. Enter your source server’s IP/domain, WHM username, and password
  3. Select the accounts you want to move, check Copy Accounts and Copy DNS Zones to sync DNS records automatically
  4. Start the transfer and monitor the log for errors—WHM handles most heavy lifting like file sync, database imports, and mail migration.

Option 2: Manual Migration (For Non-cPanel Sources)

If your old server isn’t cPanel, you’ll need to do a bit more legwork:

  • File Sync: Use rsync (faster than FTP) to copy site files to the target cPanel account’s public_html directory:
    rsync -avz old-server-username@old-server-ip:/home/old-server-username/public_html/ /home/new-cpanel-username/public_html/
    
    After syncing, fix file permissions: Set directories to 755 and files to 644 (you can do this via cPanel’s File Manager or terminal).
  • Database Setup: Create a new database and user in cPanel’s MySQL Databases, grant full permissions, then import your saved SQL file via phpMyAdmin.
  • Mail Migration: Use a tool like ImapSync to sync emails from your old server to the new cPanel mail accounts, or download emails locally via your mail client and re-import them.
4. Test Before Going Live & Switch Over

Don’t flip the switch until you’ve verified everything works:

  • Local Hosts File Test: Edit your computer’s hosts file to map your site domains to the target server’s IP. This lets you test the live site without affecting real users:
    • Windows: C:\Windows\System32\drivers\etc\hosts
    • Linux/macOS: /etc/hosts
      Add a line like:
    123.45.67.89 your-site-domain.com
    
    Visit the site, test forms, database-driven content, and email sending/receiving to confirm all functions work.
  • Wait for DNS Propagation: Once testing passes, let DNS do its thing (usually 24-48 hours). You can speed this up by lowering your domain’s TTL to 300 seconds a day before migration—this reduces cache time across DNS servers.
  • Post-Migration Checks: Use dig to confirm your site’s NS records point to ns1/ns2.example.com and the A record matches your target server IP:
    dig your-site-domain.com NS +short
    dig your-site-domain.com A +short
    
Quick Troubleshooting Tips
  • 500 Internal Server Error: Almost always a permission issue—double-check file/directory ownership matches your cPanel username, and set permissions to 755 (dirs) / 644 (files).
  • Database Connection Failures: Verify your site’s config file (like wp-config.php for WordPress) has the correct database name, username, and password from the target cPanel setup.
  • DNS Delays: If some users still see the old site, remind them to clear their browser cache or wait for their local DNS to refresh.

内容的提问来源于stack exchange,提问作者user3058948

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:01:50