How to Migrate a Website to a VPS

Performance 4 min read Updated June 2026

Whether you're moving from shared hosting, another cloud provider, or a local machine, this guide walks you through migrating a website with minimal downtime.

Migration Overview

A typical website migration involves:

  1. Setting up the new server. Deploy your first VPS with bithost.
  2. Copying files and database
  3. Testing on the new server
  4. Updating DNS to point to the new server
  5. Verifying everything works

Step 1: Prepare the New Server

Make sure your new server has everything installed:

Step 2: Export Your Website Files

From Shared Hosting (via FTP/SFTP)

Use FileZilla or your file manager to download all files from your hosting's public_html (or equivalent) to your local machine.

From Another Server (via SCP)

# From your local machine, download files from the old server
scp -r root@OLD_SERVER_IP:/var/www/mysite/ ./mysite-backup/

Step 3: Export the Database (if applicable)

MySQL/MariaDB

On the old server:

mysqldump -u root -p database_name > site_backup.sql

Download it to your local machine:

scp root@OLD_SERVER_IP:~/site_backup.sql ./

Step 4: Upload Files to the New Server

# Upload files to the new server
scp -r ./mysite-backup/ root@NEW_SERVER_IP:/var/www/mysite/

# Set correct permissions
ssh root@NEW_SERVER_IP "chown -R www-data:www-data /var/www/mysite && chmod -R 755 /var/www/mysite"

Step 5: Import the Database on the New Server

Upload the SQL file:

scp ./site_backup.sql root@NEW_SERVER_IP:~/

On the new server, create the database and import:

mysql -u root -p
CREATE DATABASE mysite_db;
CREATE USER 'mysite_user'@'localhost' IDENTIFIED BY 'StrongPassword!';
GRANT ALL PRIVILEGES ON mysite_db.* TO 'mysite_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
mysql -u root -p mysite_db < ~/site_backup.sql

Step 6: Update the Site's Database Configuration

For WordPress, update wp-config.php with the new database credentials:

nano /var/www/mysite/wp-config.php

For other CMS or apps, update their respective config files.

Step 7: Configure Nginx on the New Server

Make sure your Nginx server block is correctly configured for your domain:

nano /etc/nginx/sites-available/mysite
server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;
    root /var/www/mysite;
    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.1-fpm.sock;
    }
}

Enable and reload Nginx.

Step 8: Test Before Switching DNS

Test your site on the new server before changing DNS by editing your local hosts file:

On macOS/Linux

sudo nano /etc/hosts

Add:

NEW_SERVER_IP    yourdomain.com
NEW_SERVER_IP    www.yourdomain.com

Visit your domain in the browser - it will load from the new server (only for you). Verify everything works: pages, images, forms, logins.

Remove the hosts entry when done testing.

On Windows

Edit C:\Windows\System32\drivers\etc\hosts as Administrator and add the same lines.

Step 9: Switch DNS

Once testing is successful, update your domain's DNS A record to point to the new server's IP:

How to Point Your Domain to Your Server

DNS propagation takes 15 minutes to 48 hours.

Step 10: Set Up SSL on the New Server

After DNS propagates:

certbot --nginx -d yourdomain.com -d www.yourdomain.com

For details and troubleshooting, see Set up HTTPS (SSL).

Step 11: Keep the Old Server Running Briefly

Leave the old server running for 24–48 hours after migration. Some visitors may still be resolving the old IP due to DNS caching.

Migration Checklist


Questions? Email us at [email protected] - we reply in under 2 hours, 7 days a week.

Top up in crypto.
Be root in a minute.

No cards. No KYC. Uninterrupted service since 2014. For people who'd rather not explain why they need a server.

Deploy a server →