Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 83 additions & 15 deletions pages/web_cloud/web_hosting/migrate_website_to_vps/guide.de-de.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Migrieren einer Website von einem Webhosting auf einen VPS"
excerpt: "Erfahren Sie hier, wie Sie Ihre Website von einem Webhosting auf einen OVHcloud VPS migrieren"
updated: 2024-11-06
updated: 2025-10-23
---

## Ziel
Expand Down Expand Up @@ -111,34 +111,102 @@ Folgen Sie unserer [Anleitung zur Verwendung von FileZilla](/pages/web_cloud/web
- **Username** und **Password**: die Kennungen Ihres SSH-Benutzerkontos auf dem VPS.
- **Port**: Verwenden Sie Port 22 (Standard für SFTP).

#### Schritt 3.2 - Dateien von Ihrer Website auf den VPS übertragen
#### Schritt 3.2 - Übertragen Sie Ihre Website-Dateien an den VPS

Wenn Sie auf Ihrem VPS eingeloggt sind, wird die Ordnerstruktur der lokalen Dateien links im FileZilla Interface und die Ordnerstruktur Ihres VPS rechts angezeigt.
Sobald Sie sich bei Ihrem VPS angemeldet haben, wird der Baumansicht Ihrer lokalen Dateien auf der linken Seite der FileZilla-Oberfläche angezeigt, und der Baumansicht Ihres VPS auf der rechten Seite.

Wählen Sie die Dateien für Ihre Website und die Datenbank aus, die Sie in [Schritt 1.2](#step1.2) heruntergeladen haben. Ziehen Sie sie in das Webverzeichnis Ihres VPS auf der rechten Seite des Interface. Das Webverzeichnis ist der Ort, an dem die Dateien Ihrer Website gespeichert werden, um über Internet verfügbar zu sein. Standardmäßig kann dies ein Ordner mit dem Namen `/var/www/html` oder ein anderes Verzeichnis sein, das während der Installation des Webservers in [Schritt 2.2](#step2.2) konfiguriert wurde. Stellen Sie sicher, dass Sie die Dateien in dem Ordner ablegen, der als Web Root konfiguriert ist, damit die Website ordnungsgemäß funktioniert.
Das Webverzeichnis (oder Webroot) ist der Ort, an dem Ihre Website-Dateien gespeichert werden, um im Internet zugänglich zu sein. **Standardmäßig kann es sich um einen Ordner namens `/var/www/html` oder einen anderen Ordner handeln, der während der Webserverinstallation in [Schritt 2.2](#step2.2) konfiguriert wurde**. Stellen Sie sicher, dass Ihre Dateien im Ordner platziert werden, der als **Webroot** konfiguriert ist, damit Ihre Website ordnungsgemäß funktioniert.

> [!warning]
>
> Wenn Sie sich über SFTP mit einem Nicht-Root-Benutzer (z. B. `debian`) verbinden, haben Sie keine Schreibberechtigung für `/var/www/html`.

**Einfache Vorgehensweise: in `/home` ablegen und mit `sudo` verschieben**

##### In FileZilla (SFTP)

- Auf der „Remote Site“-Seite (rechte Seite), gehen Sie zu: `/home/debian/`
- Ziehen Sie Ihre Datenbankdatei (z. B. `backup.sql`) in `/home/debian/`. **Platzieren Sie diese Sicherung nicht im Ordner, den Sie später in den Webroot kopieren** (z. B. `/home/debian/site/`) **oder im Webroot** (z. B. `/var/www/html`), da sie öffentlich heruntergeladen werden könnte.
- Erstellen Sie einen Ordner `site` in `/home/debian/` (rechtsklicken → `Verzeichnis erstellen`{.action}), und öffnen Sie ihn.
- Wählen Sie alle Ihre Website-Dateien (die Datenbankdatei sollte nicht mehr darin sein) aus und ziehen Sie sie in `/home/debian/site/`. **Ziehen Sie Ihre SQL-Dumps nicht in diesen Ordner**. Bewahren Sie sie außerhalb des Webroots auf, (z. B. `/home/debian/backup.sql`).

##### Auf Ihrem VPS

Melden Sie sich über SSH bei Ihrem VPS an, indem Sie sich an den Abschnitt „Verbindung mit Ihrem VPS“ unseres Leitfadens „[Einstieg in einen VPS](/pages/bare_metal_cloud/virtual_private_servers/starting_with_a_vps)“ beziehen.

Führen Sie die folgenden Befehle aus:

> [!warning]
>
> In diesem Beispiel ist der Webroot `/var/www/html`. Wenn Ihr Webroot anders ist (konfiguriert in Schritt 2.2), ersetzen Sie `/var/www/html` durch Ihren tatsächlichen Pfad.

Erstellen Sie den Webroot, falls er nicht existiert:

```bash
sudo mkdir -p /var/www/html
```

Kopieren Sie den Inhalt von `/home/debian/site/` in den Webroot, wobei die Ordnerstruktur und Metadaten beibehalten werden:

```bash
sudo rsync -a /home/debian/site/ /var/www/html/
```

Alternative, wenn `rsync` nicht installiert ist:

```bash
sudo cp -a /home/debian/site/. /var/www/html/
```

Weisen Sie die Dateien dem Webdienst zu (`www-data` für Nginx/Apache auf Debian/Ubuntu):

```bash
sudo chown -R www-data:www-data /var/www/html
```

Setzen Sie die Berechtigungen der Ordner auf `755` (durchsuchbar) und die Dateiberechtigungen auf `644` (lesbar):

```bash
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;
```

### Schritt 4 - Datenbank auf Ihren VPS importieren (optional)

> [!warning]
>
> Wenn Ihre Datenbank bereits auf Web Cloud Databases gehostet ist, muss sie nicht auf den VPS migriert werden. Sie können die Datenbank auf Web Cloud Databases belassen und Ihren VPS so konfigurieren, dass er sich mit dieser Datenbank verbindet ([Schritt 5](#step5)).

Wenn Sie die Datenbank auf Ihren VPS importieren möchten, folgen Sie den nachstehenden Schritten.
#### Vor dem Start

Loggen Sie sich via SSH in Ihrem VPS ein, indem Sie den Abschnitt „Mit Ihrem VPS verbinden“ unserer Anleitung „[Erste Schritte mit einem VPS](/pages/bare_metal_cloud/virtual_private_servers/starting_with_a_vps)“ lesen.
- Ihre Sicherungsdatei (`.sql`) wurde in Schritt 3.2 platziert (z. B. `/home/debian/backup.sql`).
- Das **D**ata**B**ase **M**anagement **S**ystem (**DBMS**) (MySQL / MariaDB) und sein Befehlszeilen-Client wurden in [Schritt 2.2](#step2.2) installiert.
- Die Datenbank **`db_name`**:
- **existiert bereits**, wenn Sie sie während Schritt 2.2 (oder über Ihr Adminpanel) erstellt haben.
- **kann automatisch erstellt werden**, wenn Ihre Sicherungsdatei `.sql` `CREATE DATABASE` enthält.
- **sonst erstellen Sie sie vor dem Import**:

Wenn Sie via SSH mit Ihrem VPS verbunden sind, verwenden Sie die folgenden Befehle, um den Import der Datenbank durchzuführen.
```bash
sudo mysql -e "CREATE DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
```

Im folgenden Beispiel verwenden wir MySQL als **D**ata**B**ase **M**anagement **S**ystem (**DBMS**). Verwenden Sie die offizielle DBMS-Dokumentation, die Sie in [Schritt 2.2](#step2.2) installiert haben, um die Datenbank über die entsprechenden Befehle in Ihren VPS zu importieren.
(ersetzen Sie `db_name` durch Ihren gewünschten Namen).

```php
<?php
system("mysql -u user_name -p db_name < root/to/file.sql
");
?>
```
#### Import der Datenbank

1. Melden Sie sich über SSH bei Ihrem VPS an, indem Sie sich an den Abschnitt „Verbindung mit Ihrem VPS“ unseres Leitfadens „[Einstieg in einen VPS](/pages/bare_metal_cloud/virtual_private_servers/starting_with_a_vps)“ beziehen.
2. Starten Sie den Import mit dem DBMS-Client:

Im folgenden Beispiel verwenden wir MySQL als DBMS. Verwenden Sie die offizielle Dokumentation des DBMS, das Sie während [Schritt 2.2](#step2.2) installiert haben, um den entsprechenden Befehl für den Import der Datenbank auf Ihren VPS zu verwenden.

```bash
mysql -u user_name -p db_name < /home/debian/backup.sql
```

- Ersetzen Sie `user_name` durch Ihren MySQL-(MySQL/MariaDB)-Benutzernamen, nicht Ihren SSH-Anmeldenamen.
- Ersetzen Sie `db_name` durch den Namen der zu importierenden Datenbank.

Ersetzen Sie `user_name` durch Ihren MySQL-Benutzernamen, `db_name` durch den Namen der zu importierenden Datenbank und `root/to/file.sql` durch den Pfad der gesicherten SQL-Datei.
3. Geben Sie das DBMS-Benutzerkennwort ein, wenn Sie dazu aufgefordert werden, und warten Sie, bis der Import abgeschlossen ist.

### Schritt 5 - Konfigurationsdateien Ihrer Website einrichten <a name="step5"></a>

Expand Down
96 changes: 82 additions & 14 deletions pages/web_cloud/web_hosting/migrate_website_to_vps/guide.en-asia.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "How to migrate a website from a web hosting plan to a VPS"
excerpt: "Find out how to migrate your website from a web hosting plan to an OVHcloud VPS"
updated: 2024-11-06
updated: 2025-10-23
---

## Objective
Expand Down Expand Up @@ -116,30 +116,98 @@ Follow our [guide on using FileZilla](/pages/web_cloud/web_hosting/ftp_filezilla

Once you are logged in to your VPS, the tree-view of your local files will appear on the left-hand side of the FileZilla interface, and the tree-view of your VPS on the right-hand side.

Select the files from your website and the database that you downloaded in [step 1.2](#step1.2). Drag them to the web directory of your VPS on the right-hand side of the interface. The web directory is where your website files will be stored to be accessible on the internet. By default, this can be a folder named `/var/www/html`, or another directory configured during the installation of your web server in [step 2.2](#step2.2). Make sure that you put your files in the folder that is set up as the web root for your website to work properly.
The web directory (or web root) is where your website files will be stored to be accessible on the internet. **By default, it may be a folder named `/var/www/html` or another directory configured during your web server installation in [step 2.2](#step2.2)**. Ensure your files are placed in the directory configured as the **web root** to ensure your site functions correctly.

> [!warning]
>
> If you are connected via SFTP with a non-root user (e.g., `debian`), you will not have permission to write directly into `/var/www/html`.

**Simple procedure: drop into `/home` then move with `sudo`**

##### In FileZilla (SFTP)

- On the "Remote Site" side (right panel), go to: `/home/debian/`
- Drag and drop your database file (e.g., `backup.sql`) into `/home/debian/`. **Do not place this backup in the folder you will copy to the web root** (e.g., `/home/debian/site/`) **or in the web root** (e.g., `/var/www/html`), as it could be publicly downloadable.
- Create a `site` folder in `/home/debian/` (right-click → `Create a directory`{.action}), then open it.
- Select all your website files (the database file should no longer be there) and drag and drop them into `/home/debian/site/`. **Do not drop your SQL dumps into this folder**. Keep them outside the web root, (e.g., `/home/debian/backup.sql`).

##### On your VPS

Connect to the VPS via SSH by referring to the "Connect to your VPS" section of our guide "[Getting started with a VPS](/pages/bare_metal_cloud/virtual_private_servers/starting_with_a_vps)".

Run the following commands:

> [!warning]
>
> In this example, the web root is `/var/www/html`. If your web root is different (configured in step 2.2), replace `/var/www/html` with your actual path.

Create the web root if it does not exist:

```bash
sudo mkdir -p /var/www/html
```

Copy the contents of `/home/debian/site/` to the web root while preserving the directory structure and metadata:

```bash
sudo rsync -a /home/debian/site/ /var/www/html/
```

Alternative if `rsync` is not installed:

```bash
sudo cp -a /home/debian/site/. /var/www/html/
```

Assign ownership of the files to the web service (`www-data` for Nginx/Apache on Debian/Ubuntu):

```bash
sudo chown -R www-data:www-data /var/www/html
```

Set directory permissions to `755` (navigable) and file permissions to `644` (readable):

```bash
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;
```

### Step 4 - Import the database onto your VPS (optional)

> [!warning]
>
> If your database is already hosted on a Web Cloud Databases service, you do not need to migrate it to the VPS. You can keep the database on the Web Cloud Databases service and configure your VPS to connect to this database ([step 5](#step5)).

If you would like to import the database onto your VPS, follow the steps below.
#### Before you begin

Log in to your VPS via SSH, by going to the "Log in to your VPS section" of our guide on "[How to get started with a VPS](/pages/bare_metal_cloud/virtual_private_servers/starting_with_a_vps)".
- Your backup file (`.sql`) was placed in step 3.2 (e.g., `/home/debian/backup.sql`).
- The **D**ata**B**ase **M**anagement **S**ystem (**DBMS**) (MySQL / MariaDB) and its command-line client were installed in [step 2.2](#step2.2).
- The database **`db_name`** :
- **already exists** if you created it during step 2.2 (or via your admin panel).
- **can be created automatically** if your backup `.sql` contains `CREATE DATABASE`.
- **otherwise, create it before importing** :

Once you have connected to your VPS via an SSH connection, use the commands below to import the database.
```bash
sudo mysql -e "CREATE DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
```

In the example below, we use MySQL as a **D**ata**B**ase **M**anagement **S**ystem (**DBMS**). Use the official DBMS documentation that you installed in [step 2.2](#step2.2) to use the appropriate commands to import the database to your VPS.
(replace `db_name` with your desired name).

```php
<?php
system("mysql -u user_name -p db_name < root/to/file.sql
");
?>
```
#### Import the database

1. Connect to the VPS via SSH by referring to the "Connect to your VPS" section of our guide "[Getting started with a VPS](/pages/bare_metal_cloud/virtual_private_servers/starting_with_a_vps)".
2. Launch the import using the DBMS client:

In the example below, we use MySQL as the DBMS. Use the official documentation of the DBMS you installed during [step 2.2](#step2.2) to use the appropriate command for importing the database onto your VPS.

```bash
mysql -u user_name -p db_name < /home/debian/backup.sql
```

- Replace `user_name` with your MySQL (MySQL/MariaDB) username, not your SSH login.
- Replace `db_name` with the name of the database to import.

Replace `user_name` with your MySQL username, `db_name` with the name of the database to import, and `root/to/file.sql` with the path to the backed-up SQL file.
3. Enter the DBMS user password when prompted and wait for the import to complete.

### Step 5 - Set up your website’s configuration files <a name="step5"></a>

Expand Down Expand Up @@ -255,4 +323,4 @@ For a full list of security best practices, please read our guide on "[How to se

For specialized services (SEO, development, etc.), contact [OVHcloud partners](/links/partner).

Join our [community of users](/links/community).
Join our [community of users](/links/community).
Loading