1. Sort Out Email First
Shared hosting usually includes mailboxes on the same server. Before you change any DNS, decide where email will live: stay with your current host for email only, or move to an email provider. Note your current MX, SPF (TXT) and DKIM records, and do not change them when you move the website. Only the A records for the site change.
2. Download Your Site from cPanel
- Files: in File Manager, compress
public_htmland download the archive. Or use Backup and download a home directory backup. - Database: in phpMyAdmin, select the database, choose Export, and keep the default SQL format.
- Settings: note the database name, user and password from your site's config (for WordPress,
wp-config.php), and any cron jobs listed under Cron Jobs.
3. Set Up the VPS
Start with first steps on a new Linux server, then install a web server, PHP and a database. For a WordPress site on Ubuntu 24.04:
sudo apt install -y nginx mariadb-server php-fpm php-mysql php-curl php-gd \ php-mbstring php-xml php-zip php-intl php-imagick
How to host a website on a VPS covers the Nginx site, the firewall and the free HTTPS certificate. For PHP, the site's Nginx config also needs to pass .php files to PHP-FPM (the default site file in /etc/nginx/sites-available has the block, commented out).
4. Restore the Files and Database
Upload the archive and the SQL file, then on the server:
sudo mkdir -p /var/www/example.com sudo tar -xzf public_html.tar.gz -C /var/www/example.com --strip-components=1 sudo chown -R www-data:www-data /var/www/example.com sudo mariadb -e "CREATE DATABASE mysite; CREATE USER 'mysite'@'localhost' IDENTIFIED BY 'a-long-password'; GRANT ALL ON mysite.* TO 'mysite'@'localhost';" sudo mariadb mysite < mysite.sql
Use the same database name, user and password as before, or update the site's config to match. The --strip-components=1 assumes the archive contains a public_html folder; check with tar -tzf public_html.tar.gz | head.
5. Test, Then Switch DNS
Test the new server before anyone else sees it by pointing only your own computer at it through your hosts file. The steps for that, and for a final copy of changes before switching, are in How to move a website to a new server. Then change the A records for the domain and www to the VPS's address, leaving the email records alone.
6. What You Now Look After
On shared hosting, the host did these for you. On a VPS, set them up once: automatic security updates, nightly database backups and file backups, and keeping WordPress and its plugins up to date.