How to migrate a website from a VPS to a Dedicated Server or a Public Cloud instance

View as Markdown

Find out how to migrate your website from a VPS to a Dedicated Server or a Public Cloud instance

Objective

As your website grows, the resources of a VPS can quickly become insufficient to meet your growing needs in terms of performance, traffic management, or processing complex tasks. By migrating to a dedicated server or Public Cloud instance, you benefit from a more powerful and customizable infrastructure, adapted to more demanding workloads. This guide focuses on the essential steps for carrying out this migration efficiently, while ensuring service continuity.

Find out how to migrate your website from a VPS to a dedicated server or a Public Cloud instance.

Requirements

  • Administrative access to the source VPS (via SSH).
  • A dedicated server or Public Cloud instance in your OVHcloud account.
  • Administrator access to the destination server (via SSH).
  • Knowledge of server management basics (Apache/Nginx, databases, etc.).

Instructions

Information regarding OVHcloud service administration and how to find appropriate assistance

When using OVHcloud guides, please be aware of the following conditions:

  • User instructions aim to provide as many details as possible but cannot cover individual use cases. You might need to adapt the pertinent actions to your requirements.
  • The OVHcloud ecosystem is built for flexibility and freedom of choice. Customers are therefore responsible for the secure and proper configuration of their services. To prevent data loss, we strongly recommend to apply backup strategies to all your important data.
  • Our guides and tutorials may reference third-party software or services in combination with OVHcloud solutions. The technical support provided by OVHcloud does not include the configuration of systems or products outside of our responsibility. This includes but is not limited to:
    • Operating systems and user interfaces (Windows, Debian, Plesk, etc.).
    • Any other third-party software (FTP clients, email software, etc.).
    • Services offered by other providers (DNS, APIs, user interfaces, etc.).

To receive the appropriate assistance for any issues you might experience, follow these guidelines:

  • You seek personalized advice or you would like to discuss a topic that is not covered in detail by our documentation?
    Join the OVHcloud Community to search for your topic and reach out to other users.
  • You need to report an incident regarding your OVHcloud service or you are experiencing difficulties in the OVHcloud Control Panel?
    Create a support request in our Help Centre.
  • You require professional assistance for your project or you need help with tasks outside our support scope?
    Visit our partner portal to search for experts who are familiar with OVHcloud solutions.
  • You are looking for more detailed information regarding our support levels and Professional Services?
    Please visit our web pages for OVHcloud support levels and OVHcloud Professional Services.

You can participate in improving our documentation:

  • You would like to share feedback to improve a guide page or you want to report insufficient information on a specific page?
    Use the "Was this page helpful?" buttons at the bottom of the page to let us know.
  • You would like to propose a specific documentation update?
    Use the "Edit this page" function, available at the bottom of the page and in the sidebar.

Content overview

Step 1 - Back up your website files and database

The first step is to back up all of your website’s files.

Step 1.1 - Back up files

Log in to your VPS via SSH, and save your website files:

ssh <user>@<vps_ip>
cd /var/www/html
tar -czf site_backup.tar.gz *

Replace:

  • <user>: by the user you use to connect to the VPS.
  • <vps_ip>: by the IP address of your VPS.

Step 1.2 - Back up the database

If your website uses a database, save it using the command lines provided by your DataBase Management System (DBMS).

MySQL and MariaDB
PostgreSQL
MongoDB
Open-source Redis®
mysqldump -u `<db_user>` -p `<db_name>` > database_backup.sql

Replace:

  • <db_user>: by the database user name.
  • <db_name>: by the database name.

If you are using another DBMS, refer to its official documentation to find the commands for backing up the database.

Step 2 - Prepare the destination Dedicated Server or Public Cloud Instance

Before you migrate your website’s files and databases, prepare your destination server.

Step 2.1 - Create and configure the Public Cloud instance

If you are unfamiliar with Public Cloud, please refer to our guide on "Getting started with Public Cloud".

To create and configure a Public Cloud instance, follow the steps in our guide on "Creating and connecting to a Public Cloud instance".

Step 2.2 - Install and configure the dedicated server

To prepare your dedicated server, please read our guide on "Getting started with a dedicated server".

This guide will help you in:

  • Installation of an operating system.
  • Your server configuration to allow access via SSH.
  • The initial connection to prepare the deployment of your website files.

Step 3 - Transfer the files and database to the destination server

After preparing your dedicated server or Public Cloud instance, transfer the backed-up files and database from your VPS.

Step 3.1 - Transfer files

Use the rsync tool to transfer archived files to the destination server. This method is fast, secure, and allows file permissions to be retained.

1. Log in from your VPS and launch the transfer via SSH:

rsync -avz /var/www/html/site_backup.tar.gz <user>@<destination_ip>:/var/www/html/

Replace:

  • <user>: by the destination server's user.
  • <destination_ip>: by the IP address of the dedicated server or Public Cloud instance.

For more details on using rsync, please refer to our guide "How to copy data from one server to another using rsync".

2. Once the files are transferred, connect to the destination server and extract the archive:

ssh `<user>`@`<destination_ip>`
cd /var/www/html
tar -xzf site_backup.tar.gz

Step 3.2 - Import the database

Warning

If your database is already hosted on a Web Cloud Databases service, you do not need to migrate it to the destination server. Keep the database on the Web Cloud Databases service, and configure your server to connect to this database (step 4.2).

1. Create a new database

Connect via SSH to a dedicated server or a Public Cloud instance. Create a new database based on your DBMS:

MySQL and MariaDB
PostgreSQL
MongoDB
Open-source Redis®

To create a new database, please refer to MySQL official documentation

2. Import the database

Use the command line below to import the database you backed up in step 1.2.

In the example below, we use MySQL. Use the official DBMS documentation that you installed in the previous step to use the appropriate command line to import the database to your server.

mysql -u user_name -p db_name < root/to/database_backup.sql

Replace:

  • user_name: by your MySQL username.
  • db_name: by the database name.
  • root/to/database_backup.sql: by the path of the backed-up SQL file.

Step 4 - Configure the website on the destination server

After transferring the files and importing the database, configure your destination server to support your website.

Step 4.1 - Configure the web server

To associate your website with its domain or subdomain, configure a virtual host:

1. Apache

Step 1
Step 2
Step 3
Step 4

Create a configuration file for your website (replace your_website with a name that is meaningful for your project):

sudo nano /etc/apache2/sites-available/your_website.conf

2. Nginx

Step 1
Step 2
Step 3
Step 4

Create a configuration file for your website (replace your_website with a name that is meaningful for your project):

sudo nano /etc/nginx/sites-available/your_website

Step 4.2 - Configure your website’s configuration files

Once you have configured your web server, it is important to update your website’s configuration files to ensure that it will work properly. The main variables to adjust are often the database connection information, as well as folder paths. Here are the specific configurations to update for the main CMSs.

WordPress
PrestaShop
Joomla!
Drupal
Without CMS

Modify the following variables in the wp-config.php file:

  • DB_NAME: The database name.
  • DB_USER: The database user.
  • DB_PASSWORD : the user password.
  • DB_HOST : the database host (usually localhost).

For more details, see the WordPress official documentation.

To avoid security issues, refer to the official documentation on file permissions for WordPress

If you use a Web Cloud Databases database, make sure that your server is authorized to connect to it. To do this, add the server's IP address to the list of authorized IP addresses. This configuration secures access to the database and prevents connection problems. Please refer to the "Authorize an IP address" section of our guide "Getting started with the Web Cloud Databases service".

Step 5 - Update DNS records

Info

Before you modify your DNS zone records to point to the IP address of the destination server, we recommend reducing the Time To Live (TTL). This speeds up the propagation of changes, because DNS servers will update information more quickly. Follow the "Time to propagate" step in our guide on "Editing an OVHcloud DNS zone" to adjust the TTL to point the domain name to the destination server.

To point your website’s domain name to your dedicated server or Public Cloud instance, configure the domain name’s DNS records to direct traffic to your server’s public IP address. To guide you through this process, follow our guide on "Editing an OVHcloud DNS zone".

Step 6 - Check that your website is working properly

Once the migration is complete, test your website to make sure it works as expected. Check all essential features (forms, user connections, online payment, etc.) and ensure that all pages display correctly.

Step 7 - Secure your dedicated server or Public Cloud instance

Once you have migrated your website to a dedicated server or Public Cloud instance, it is vital to secure your server, to protect your data and ensure that your services work properly.

For a full list of security best practices, please refer to our guides "Securing a dedicated server" and "Best practices for securing and structuring OVHcloud Public Cloud projects".

Go further

For specialized services (SEO, development, etc.), contact the OVHcloud partners.

Join our community of users.

Was this page helpful?