How-to For WordPress on App Service (WindowsLinux )

4 minute read • September 12, 2017

mksunitha
With both App Service for Windows and Linux  today , setting up  and configuration of your WordPress app is different in some way based on whether you are using Linux vs Windows . The matrix below can help guide your the appropriate documentation and steps for your WordPress app  
Web App on Windows  Web App on Linux (Built-in) Web App for Containers
Overview Web App on Windows Web App on Linux (Built-in) Web App for Containers
How do I create New WordPress app Use the Azure Marketplace Template for WordPress This template also creates a database for your Web App based on your database provider choice Use Web App on Linux with Built-in PHP runtime  You need to create a database if creating the app using this method. Read this article to know whether to use built-in or custom docker image Use the Azure Marketplace Template for WordPress on Linux This template also creates a database for your Web App based on your database provider choice.
How do I modify PHP configuration Add a  .user.ini to site/wwwroot folder and update PHP configuration . Use .htaccess to update PHP configuration if using PHP built-in image or custom image with Apache server Use .htaccess to update PHP configuration if using PHP built-in image or custom image with Apache server If you are using your own docker image , make the appropriate changes based on your server for example ngnix
How do I debug WordPress WordPress has debugging Capability . For more information , click here
How do I add a domain to WordPress app STEP 1 : Buy a custom domain from Azure and configure your web app Or  use an existing domain to configure your web app. STEP 2 : WordPress needs additional changes to resolve to the new domain
  • Login to Wordpress dashboard
  • Click Settings, and then click General.
  • In the WordPress address (URL) and Site address (URL) fields, enter the new domain name or URL you want to use, and then click Save Changes.
  • Now browse your site with the new domain
  • If you are using permalinks and its not resolving with new domain you might need to reset your WordPress site's permalinks. To do this
    • From the Settings menu, click Permalinks.
    • Note which kind of Permalink you currently use.
    • Select any Permalink setting other than the one you currently use, and then click Save Changes.
    • Select your original Permalink setting, and then click Save Changes.
How to add SSL certificate binding for my domain Bind an existing custom SSL certificate to Azure Web Apps Buy and Configure an SSL Certificate for your Azure App Service
How do I connect WordPress app with a database using SSL For more information click this  link
How do I migrate my database to Azure database for MySQL (Preview) For more information , click this link
Which database provider should I use with WordPress Click this link to help choose the appropriate database provider
How do I migrate existing WordPress app
  • Identify your app dependencies to understand whether Windows or Linux built-in or Web app for Containers is the right choice
  • Create a Empty Web App on Azure
    • Choose Windows OS for Windows App Service
    • Choose Linux if you are using built-in PHP . OR You can bring your own custom image  using Web App for Containers
  • Create a database for your app based on the database provider you have selected
  • Migrate your database , for more information click this link
  • Copy all your files to  Azure web app using FTP or Git
  • Update wp-config.php to point to the desired database for the azure web app
  • If your wp-config.php files has any hard-coded paths please remove them or update them to use
    • /home/site/wwwroot (Linux)
    • D:\home\site\wwwroot ( Windows)
  • WordPress stored the URL of your web app in the database. Make sure you update the database to use your-site-name.azurewebsites.net or configure the appropriate domain to your app
Continuous Integration (CI)/Continuous Deployment(CD) For more information , click this link . Here the continuous integration refers to only you application code. For more information , click this link. This depends on how you image is built :
  1. If your image has your application code included , then CI/CD refers to updates to your docker image
  2. If your image has only server components like apache , php etc and application code is on VSTS/Github ; then there are two deployments that need to configured for CI/CD : one for your application code and one for your docker image. Refer to this article
Troubleshooting Platform Issues For more information , click this link For more information click this linkCheckout the FAQ as well.
Scaling Application For more information click this link For more information click this link For more information click this link Note: When using Web App for containers you must use the App Settings WEBSITES_ENABLE_APP_SERVICE_STORAGE = true in order to use App Service storage which will allows file changes to persists and be shared by all the instances
Performance Enhancements
  • WP Super cache :It significantly improves site throughput and correctly handles comments submissions and other visitors’ actions.
  • Azure Redis cache : Azure redis cache can also be integrated with WordPress with the help of WP redis plugin to get better performance.
  • Static content Caching : Cache JS, CSS files
  • Server level caching :
    • For Windows App Service , you can use IIS output caching, click here
    • For App Service on Linux , use caching on Apache . Click here
    • For Web App for Containers , you can include different types of caching within your custom image from local redis to APC or additional caching based on the server you use ( Nginx, Apache etc )