Pre-Migration Checklist
| Step | Status |
|---|---|
| Inventory all files, databases, and services | |
| Note current server specs (CPU, RAM, disk) | |
| Choose matching or larger Kazepute plan | |
| Set up SSH keys on new server | |
| Lower DNS TTL to 300 seconds (48 hours before) |
Step 1: Prepare the New Server
# Update system
sudo apt update && sudo apt upgrade -y
# Install required software
sudo apt install -y nginx php8.3-fpm php8.3-mysql php8.3-mbstring \
php8.3-xml php8.3-curl php8.3-zip php8.3-gd mariadb-server
# Secure MariaDB
sudo mysql_secure_installation
Step 2: Migrate the Database
On the old server:
mysqldump -u root -p --all-databases --single-transaction > all_databases.sql
gzip all_databases.sql
scp all_databases.sql.gz deploy@new-server-ip:~/
On the new server:
gunzip all_databases.sql.gz
sudo mysql < all_databases.sql
Step 3: Migrate Files
# From old server — sync web files
rsync -avz --progress -e ssh /var/www/html/ deploy@new-server-ip:/var/www/html/
# Sync configuration
rsync -avz /etc/nginx/sites-available/ deploy@new-server-ip:~/nginx-configs/
Step 4: Configure Web Server
# Copy Nginx configs
sudo cp ~/nginx-configs/* /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/mysite.conf /etc/nginx/sites-enabled/
# Test and reload
sudo nginx -t && sudo systemctl reload nginx
Step 5: SSL Certificates
# Install certbot
sudo apt install -y certbot python3-certbot-nginx
# Get new certificates (after DNS points to new server)
sudo certbot --nginx -d example.com -d www.example.com
Step 6: Switch DNS
Update your A record to point to the new server IP. With TTL lowered to 300 seconds, propagation is fast.
# Verify DNS is pointing to new server
dig +short example.com
Step 7: Post-Migration Verification
| Check | How |
|---|---|
| Website loads | Visit in browser |
| SSL working | Check for padlock |
| All pages work | Click through main sections |
| Forms submit | Test contact/login forms |
| Database connections | Test dynamic content |
| Email sending | Test notification emails |
| Cron jobs set up | crontab -l |
| Backups configured | Verify backup script runs |
Rollback Plan
Keep the old server running for at least 7 days after migration. If anything goes wrong:
- Point DNS back to old server
- Investigate and fix the issue on the new server
- Re-attempt migration
Tip Do the DNS switch during your lowest-traffic hours. Monitor the new server closely for the first 24 hours.