Flash VPS: limited-stock promo offers available now.
View promos
← Back to articles
Article

How to Migrate a WordPress Site to a VPS

Migrating WordPress to a VPS gives you more control, performance, and flexibility. Here’s a complete guide to move your site properly.

Updated on October 23, 2025 ~ 2 min read

How to Migrate a WordPress Site to a VPS

Switching from shared hosting to a VPS gives your WordPress site faster load times, stronger security, and total control. This guide walks you through the entire migration process step by step.

1. Prepare your new VPS

Start with a clean Debian or Ubuntu installation. Install the essentials:

sudo apt update && sudo apt install nginx mariadb-server php php-fpm php-mysql unzip

2. Backup your current site

Download your public_html files and export your database using phpMyAdmin or mysqldump. Save them in a ZIP archive for transfer.

3. Transfer the files to your VPS

Use scp or FileZilla to upload your files:

scp backup-wordpress.zip user@your-vps-ip:/var/www/

Then extract them:

unzip backup-wordpress.zip -d /var/www/yourdomain

4. Import the database

Create a new database:

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER "wpuser"@"localhost" IDENTIFIED BY "password";
GRANT ALL PRIVILEGES ON wordpress.* TO "wpuser"@"localhost";
FLUSH PRIVILEGES;

Import your SQL dump:

mysql -u wpuser -p wordpress < backup.sql

5. Configure Nginx or Apache

For Nginx:

server {
 listen 80;
 server_name yourdomain.com;
 root /var/www/yourdomain;
 index index.php index.html;
 location / {
 try_files $uri $uri/ /index.php?$args;
 }
 location ~ \.php$ {
 include snippets/fastcgi-php.conf;
 fastcgi_pass unix:/run/php/php8.2-fpm.sock;
 }
}

For Apache:

a2enmod rewrite
nano /etc/apache2/sites-available/yourdomain.conf

6. Update wp-config.php

define("DB_NAME", "wordpress");
define("DB_USER", "wpuser");
define("DB_PASSWORD", "password");
define("DB_HOST", "localhost");

7. Enable HTTPS with Let’s Encrypt

Secure your site for free using Let’s Encrypt:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

8. Connect through Cloudflare

Set up your domain with Cloudflare to add DDoS protection, caching, and global CDN delivery. Enable the orange cloud (proxy) and set your DNS A/AAAA records accordingly.

9. Verify performance

Clear your WordPress cache and test site speed using PageSpeed Insights or WebPageTest.

Conclusion

Moving your WordPress site to a VPS gives you speed, independence, and full control. Deploy your optimized instance today at https://vps1dollar.com.

Also read: How to Choose a VPS

Blog & resources