Virteche
Guideschevron_rightServers

Servers · 8 min read · Updated

Moving from Shared Hosting or cPanel to a VPS

Moving from shared hosting to a VPS means taking three things with you: your website files, your database, and your DNS settings. From cPanel, download the files from the File Manager or a full backup, and export the database from phpMyAdmin. On the VPS, install a web server and database, restore both, test, then point DNS at the new server. The one thing a VPS does not include is email hosting, so move email to an email provider first, or leave it where it is.

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_html and 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.

Common Questions

  • Is a VPS harder to run than shared hosting?

    Yes, a little. You get root access and full control, which also means installing updates and setting up backups yourself. The guides linked here cover each of those, and most of it is set up once.

  • Can I keep cPanel?

    cPanel can be installed on a VPS with its own licence from cPanel. Many people find they do not need it: Nginx, a database and a few commands replace most of what they used it for.

  • What about my email accounts?

    Keep email with a dedicated email provider rather than running a mail server on the VPS. Point the domain's MX records at that provider and the website move does not touch your mail at all.

  • My site sends email (contact forms, orders). Will that still work?

    Yes, through an email provider or a transactional email service on port 587 or 465, using an SMTP plugin in WordPress. On Virteche Cloud, outgoing connections on port 25 are blocked to keep our addresses off spam blocklists.

KVM servers in Ashburn and Dallas with full root access, dedicated vCPU and a dedicated IPv4 address.

See VPS plans

Keep Reading

All guides