|
| 1 | +--- |
| 2 | +title: Migrate WordPress to App Service on Linux |
| 3 | +description: Migrate WordPress to App Service on Linux. |
| 4 | +author: msangapu-msft |
| 5 | + |
| 6 | +ms.topic: article |
| 7 | +ms.date: 01/20/2023 |
| 8 | +ms.author: msangapu |
| 9 | +ms.devlang: php |
| 10 | +ms.custom: seodec18 |
| 11 | + |
| 12 | +--- |
| 13 | +# Migrate WordPress on App Service on Linux |
| 14 | + |
| 15 | +This article describes two ways to migrate WordPress from App Service on Windows or external hosting providers to App Service on Linux. |
| 16 | + |
| 17 | +> [!NOTE] |
| 18 | +> Migrate the content to a test instance, validate all scenarios, and if everything works as expected, swap this instance to the production slot. |
| 19 | +> |
| 20 | +
|
| 21 | + You can migrate your site to WordPress on Azure App Service in two ways: |
| 22 | + |
| 23 | + 1. WordPress plugin: All-In-One WP Migration |
| 24 | + 2. Manual process of migration |
| 25 | + |
| 26 | +## Migrate WordPress with All-In-One WP Migration plugin |
| 27 | + |
| 28 | +This plugin is popular for migrating sites with ease. This approach is recommended for sites less than 256MB. If it's more, you can either **purchase the premium version** of the plugin or **migrate manually** using the steps outlined in [manual migration process](#manual-migration-process). |
| 29 | + |
| 30 | +By default, the file upload size for WordPress on Linux App Services is limited to 50MB, and it can be increased up to 256MB (Maximum Limit). To change the file upload limit, add the following [Application Settings](configure-common.md?tabs=portal) in the App Service and save it. |
| 31 | + |
| 32 | +| Application Setting Name | Default Value | New Value | |
| 33 | +|--------------------------------|---------------|-------------| |
| 34 | +| UPLOAD_MAX_FILESIZE | 50M | 256M | |
| 35 | +| POST_MAX_SIZE | 128M | 256M | |
| 36 | + |
| 37 | +> [!IMPORTANT] |
| 38 | +> Install All-In-One Migration plugin on both source and target sites. |
| 39 | +> |
| 40 | +
|
| 41 | +### Export the data at source site |
| 42 | + |
| 43 | +1. Launch WordPress Admin page. |
| 44 | +1. Open All-In-One WP Migration plugin. |
| 45 | +1. Click on 'Export' option and specify the export type as file. |
| 46 | +1. Download the bundle. |
| 47 | + |
| 48 | +### Import the data at destination site |
| 49 | + |
| 50 | +1. Launch WordPress Admin page |
| 51 | +1. Open All-In-One WP Migration plugin |
| 52 | +1. Click on import option on the destination site, and upload the file downloaded in previous section |
| 53 | +1. Empty the caches in W3TC plugin (or any other caches) and validate the content of the site. |
| 54 | + - Click on the **Performance** option given in the left sidebar of the admin panel to open the W3TC plugin. |
| 55 | + - Then click on the **Dashboard** option shown below it. |
| 56 | + - On the dashboard, you will see a button with the label **Empty All Caches**. |
| 57 | + |
| 58 | +## Manual migration process |
| 59 | + |
| 60 | +The prerequisite is that the WordPress on Linux Azure App Service must have been created with an appropriate hosting plan from here: [WordPress on Linux App Service](https://aka.ms/linux-wordpress). |
| 61 | + |
| 62 | +### Manually export the data at source site |
| 63 | + |
| 64 | +> [!NOTE] |
| 65 | +> Depending on the size of your content and your internet connection, this operation could take several minutes. |
| 66 | +> |
| 67 | +
|
| 68 | +1. Download the **wp-content** folder from the source site. You can use popular FTP tools like [FileZilla](https://filezilla-project.org/download.php?type=client) to connect to the web server and download the content. |
| 69 | + |
| 70 | +1. Export the contents of the source database into an SQL file. You can perform this task either using MySQL client tools like HeidiSQL, [MySQL workbench](https://dev.mysql.com/downloads/workbench/), [PhpMyAdmin](https://docs.phpmyadmin.net/en/latest/setup.html) or through command line interface. For more information on exporting the database, refer to the following [documentation](https://dev.mysql.com/doc/workbench/en/wb-admin-export-import-management.html). |
| 71 | + |
| 72 | +### Manually import the data at destination site |
| 73 | + |
| 74 | +1. Create a new Wordpress app using our [WordPress on Linux App Service template](https://aka.ms/linux-wordpress) |
| 75 | + |
| 76 | +2. Open an SSH session using **WebSSH** from the Azure portal. |
| 77 | + |
| 78 | + |
| 79 | +3. Delete the existing content of **/home/site/wwwroot/wp-content** folder using the following command. |
| 80 | + |
| 81 | + ```bash |
| 82 | + rm -rf /home/site/wwwroot/wp-content/* |
| 83 | + ``` |
| 84 | + |
| 85 | +4. Upload the new contents of **wp-content** folder using the File Manager. Click on the label that says '**Drag a File/Folder here to upload, or click to select one**'. |
| 86 | + |
| 87 | +5. You can either [use an existing MySQL database](https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/using_an_existing_mysql_database.md) or migrate the content to a new Azure MySQL Flexible Server created by App Service on Linux. |
| 88 | + |
| 89 | + |
| 90 | +> [!NOTE] |
| 91 | +> Azure Database for MySQL - Single Server is on the road to retirement by 16 September 2024. If your existing MySQL database is hosted on Azure Database for MySQL - Single Server, consider migrating to Azure Database for MySQL - Flexible Server using the following steps, or using [Azure Database Migration Service (DMS)](/mysql/single-server/whats-happening-to-mysql-single-server#migrate-from-single-server-to-flexible-server). |
| 92 | +> |
| 93 | +
|
| 94 | +6. If you migrate the database, import the SQL file downloaded from the source database into the database of your newly created WordPress site. You can do it via the PhpMyAdmin dashboard available at **\<sitename\>.azurewebsites.net/phpmyadmin**. If you're unable to one single large SQL file, separate the files into parts and try uploading again. Steps to import the database through phpmyadmin are described [here](https://docs.phpmyadmin.net/en/latest/import_export.html#import). |
| 95 | + |
| 96 | +7. Launch the Azure Portal and navigate to your **App Service -> Configuration** blade. Update the database name in the **Application Settings** of App Service and save it. This will restart your App and the new changes will get reflected. [Learn more: WordPress Application Settings](https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/wordpress_application_settings.md) |
| 97 | + |
| 98 | + | Application Setting Name | Update Required? | |
| 99 | + |--------------------------------|------------------------------------------| |
| 100 | + | DATABASE_NAME | Yes, replace with the source (exported) database name | |
| 101 | + | DATABASE_HOST | Not Required | |
| 102 | + | DATABASE_USERNAME | Not Required | |
| 103 | + | DATABASE_PASSWORD | Not Required | |
| 104 | + |
| 105 | +  |
| 106 | + |
| 107 | +## Post migration actions |
| 108 | + |
| 109 | +### Install recommended plugins |
| 110 | + |
| 111 | +It's an optional step, after the site migration it is recommended to validate that you have the default recommended/equivalent plugins activated and configured accurate as before. If you're prohibited from not configuring them as per your organization governing policies, then you can uninstall the plugins. |
| 112 | + |
| 113 | +- The W3TC plugin should be activated and configured properly to use the local Redis cache server and Azure CDN/Blob Storage (if it was configured to use them originally). For more information on how to configure these, refer to the following documentations: |
| 114 | + |
| 115 | + - [Local Redis Cache](https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/wordpress_local_redis_cache.md) |
| 116 | + - [Azure CDN](https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/wordpress_azure_cdn.md) |
| 117 | + - [Azure Blob Storage](https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/wordpress_azure_blob_storage.md) |
| 118 | + |
| 119 | +- WP Smush plugin is activated and configured properly for image optimization. See [Image Compression](https://github.com/Azure/wordpress-linux-appservice/blob/main/WordPress/wordpress_image_compression.md) for more information on configuration. |
| 120 | + |
| 121 | +### Recommended WordPress settings |
| 122 | + |
| 123 | +The following WordPress settings are recommended. However, when the users migrate their custom sites, is it up to them to decide whether to use these settings or not. |
| 124 | + |
| 125 | +1. Open the WordPress Admin dashboard. |
| 126 | +2. Set the permalink structure to 'day and name', as it performs better compared to the plain permalinks that use the format **?p=123**. |
| 127 | +3. Under the comment settings, enable the option to break comments into pages. |
| 128 | +4. Show excerpts instead of the full post in the feed. |
| 129 | + |
| 130 | +## Search and replace (paths and domains) |
| 131 | + |
| 132 | +One common issue that users face during migration is that some of the contents of their old site use absolute urls/paths instead of relative ones. To resolve this issue, you can use plugins like [Search and Replace](https://wordpress.org/plugins/search-replace/) to update the database records. |
| 133 | + |
| 134 | +## Configuring custom domain |
| 135 | + |
| 136 | +To configure your site with a custom domain follow the steps described here: Tutorial: [Map existing custom DNS name](app-service-web-tutorial-custom-domain.md?tabs=a%2Cazurecli) |
| 137 | + |
| 138 | +## Migrating custom domain |
| 139 | + |
| 140 | +When you migrate a live site and its DNS domain name to App Service, that DNS name is already serving live traffic. You can avoid DNS resolution downtime by binding the active DNS name to your app as described in [Migrate an active DNS name](manage-custom-dns-migrate-domain.md). |
| 141 | + |
| 142 | +## Updating SSL certificates |
| 143 | + |
| 144 | +If your site is configured with SSL certs, then follow [Add and manage TLS/SSL certificates](configure-ssl-certificate.md?tabs=apex%2Cportal) to configure SSL. |
| 145 | + |
| 146 | +Next steps: |
| 147 | +[At-scale assessment of .NET web apps](/training/modules/migrate-app-service-migration-assistant/) |
0 commit comments