Moving a WordPress site from shared hosting to a VPS (Virtual Private Server) might sound like a big job. But don’t worry—once you understand the steps, it’s not so bad. I’ve done it many times, and I’ll walk you through it.
A VPS is like renting your own mini computer on the internet. You get more control, more power, and fewer noisy neighbors. It’s a good step up when your website starts getting more traffic or needs to run faster.
In this guide, I’ll show you how to move your WordPress site from your old server to a VPS, step by step.
What Does Migrating a Site Mean?
Migrating a site means moving all your website files and its database to a new server. It’s like packing up your house and setting it up again somewhere else. Only this house runs on PHP and MySQL instead of bricks and drywall.
You’ll be copying:
- WordPress files (themes, plugins, uploads)
- The database (your posts, pages, and settings)
- Your domain setup (so visitors land on the right server)
When I moved my first WordPress site to a VPS, I was nervous. But after doing it once, I realized it’s just like moving boxes. One box at a time.
Before You Start
Let’s get things ready.
Make sure your VPS is set up with:
- A web server like Apache or Nginx
- PHP (the language WordPress runs on)
- MySQL or MariaDB (the database)
- An SFTP or SSH connection so you can log in
You can also use a control panel if it helps. Some folks like HestiaCP or Webmin. I’ve used both, but sometimes I prefer the raw terminal—because I’m weird like that.
Step 1: Backup Your WordPress Site
The first step is to make a full copy of your site. This includes your files and your database.
To back up files:
Use your hosting panel’s file manager or an SFTP client (like FileZilla). Download everything inside the public_html
folder, or wherever your WordPress site lives.
It should include:
wp-content
folderwp-config.php
wp-admin
andwp-includes
To back up the database:
You can use phpMyAdmin (usually available in your old hosting panel):
- Log in to phpMyAdmin.
- Select your WordPress database.
- Click Export > choose Quick and SQL.
- Download the
.sql
file.
Boom—your site is now in a suitcase, ready to travel.
Step 2: Upload to the New VPS
Now it’s time to unpack on your VPS.
Upload your files:
- Use SFTP to connect to your VPS.
- Upload all your WordPress files into the correct web folder. It’s often something like
/var/www/html/
or a folder your panel created.
I once uploaded to the wrong folder and stared at a blank screen for an hour. So double-check the path!
Upload your database:
You can use the mysql
command or phpMyAdmin (if you installed it on your VPS).
Using terminal:
mysql -u your_db_user -p your_database < your_backup.sql
You’ll need to create the database first:
mysql -u root -p
CREATE DATABASE your_database;
GRANT ALL PRIVILEGES ON your_database.* TO 'your_db_user'@'localhost' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
EXIT;
Just swap in your real names instead of your_database
and friends.
Step 3: Update wp-config.php
Your old database name, user, and password might not work anymore. Open your wp-config.php
file and update these lines:
define('DB_NAME', 'your_database');
define('DB_USER', 'your_db_user');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');
Make sure the info matches your new VPS setup.
Otherwise, WordPress will freak out and say it “can’t connect to the database.” It’s basically its version of a panic attack.
Step 4: Set File Permissions
Your web server needs to read and write the WordPress files.
From the terminal, run:
sudo chown -R www-data:www-data /var/www/html
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;
This makes sure your files and folders have the right access.
Step 5: Update Your Domain DNS
If everything is uploaded and working, it’s time to point your domain to the new VPS.
In your domain registrar panel:
- Find the DNS settings
- Edit the A record to your VPS’s IP address
It might take a few hours to update across the internet. I usually make a cup of tea and check back later. If you’re impatient (like me), you can test with your computer’s hosts
file first.
Step 6: Test Everything
Before throwing a party, make sure your site loads properly.
- Can you open the homepage?
- Do posts and pages load?
- Can you log into
/wp-admin/
? - Are your images showing?
If something seems off, check the logs:
sudo tail -f /var/log/nginx/error.log
Or for Apache:
sudo tail -f /var/log/apache2/error.log
That’s where the server whispers its secrets.
Step 7: Clean Up and Secure
Once things work, delete leftover zip files or backups from your VPS.
Set up a basic firewall with UFW (Uncomplicated Firewall):
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
And don’t forget HTTPS. I always use Let’s Encrypt for free SSL:
sudo apt install certbot
sudo certbot --nginx
Or use --apache
if you use Apache.
Three Handy Tools for Migration
When I migrate sites, these tools help a lot:
- rsync – faster than regular copy for moving files
- scp – secure file transfer between servers
- mysqldump – for backing up and restoring databases
They’re free, built-in, and powerful once you get used to them.
Three Signs You’re Ready for a VPS
Not sure if it’s time to switch? Here are a few clues:
- Your site is slow on shared hosting
- You want more control or custom setup
- You’re hitting memory or CPU limits
I moved to a VPS when my site started feeling sluggish during traffic spikes. After the switch, things ran much smoother.
Three Common Mistakes to Avoid
I’ve made them all, so you don’t have to:
- Forgetting the database import – site loads with no content
- Wrong file permissions – you get 403 errors or missing images
- Wrong DNS settings – your visitors go to the old server
Always double-check and keep a backup until the new setup is working fine.
Final Thoughts
Migrating a WordPress site to a VPS is kind of like moving houses. There’s some packing, unpacking, and adjusting, but it feels good once it’s done.
Here’s a quick recap:
- Backup your files and database
- Upload to the VPS
- Fix the config file
- Point your domain
- Test and secure
If you’re still nervous, start with a small test site first. Practice makes better.
And hey, if your server crashes during the move, just tell yourself: “It’s not a bug—it’s a learning opportunity in disguise.”
Got any questions or ran into a funny error message? I’d love to hear your VPS migration story. Did your site travel smoothly, or did it take the long road with some detours?