Configure Wordpress on Azure Windows Server
In order to compare the performance of WordPress installed on Windows Server and Linux server, I plan to set up WordPress/MySQL on a Azure Windows Server 2012 R2 Data Center version following this article:
https://besthostingforasp.net/how-to-install-wordpress-on-iis/
It took me some time to configure the ftp server so that WordPress can directly update components using ftp credential. It turns out that the domain name of XXX.cloudapp.net for the ftp hosting should be used instead of my real domain name.
Since I want to access the Wordpress MySQL database directly from my .Net application, I would like to install phpMyAdmin to the server so that I can make changes to the database more easily. Here is a pretty detailed guide: How to Install and Configure phpMyAdmin on IIS in Windows 8/Server 2012
Now the WordPress setup is finished. However, when I upload my fancy NewsMag WordPress theme, I got following error message:
The uploaded file exceeds the upload_max_filesize directive in php.ini.
In order to fix the error, I changed the upload_max_filesize setting in the php.ini file from 2M to 200M
The last step is to follow the article Enabling Pretty Permalinks in WordPress to fix the issue that the user friendly URL of WordPress is not supported by default. The following web.config file is the one that I put into the WordPress folder.
Download the web.config file
After the web.config file is ready, I set the URL options in the WordPress admin page again, and the fancy URL works like a charm.
To improve the website performance, I followed the article How to make the site faster that works very well with the NewsMag WordPress theme.
When you move the css file to the foot, the js_composer.min.css?ver=4.9 should not be moved down, otherwise, the home page display will not work properly in small screen.
//$this->move_style_to_footer_queue('js_composer_front');
First, it is necessary to enable GZip on IIS. Here explains how: Enable IIS7 gzip
You can enable GZIP compression entirely in your
Web.config
file. This is particularly useful if you're on shared hosting and can't configure IIS directly, or you want your config to carry between all environments you target.
directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
mimeType="text/*" enabled="true"/>
mimeType="message/*" enabled="true"/>
mimeType="application/javascript" enabled="true"/>
mimeType="*/*" enabled="false"/>
Testing
To test whether compression is working or not, use the developer tools in Chrome or Firebug for Firefox and ensure the HTTP response header is set:
Content-Encoding: gzip
Note that this header won't be present if the response code is 304 (Not Modified). If that's the case, do a full refresh (hold shift or control while you press the refresh button) and check again.
If the compression is not working properly, check this article: IIS gZip Compression Not Working after Setting Everything
The next thing is to Set the Leverage Browser Caching. It is quite simple. Just follow this article to Configure the HTTP Expires Response Header, and then make sure you have following setting in the web.config file:
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
More details can be found here:
The performance of WordPress on Azure Windows Server is pretty good. With a premium fancy theme, and 50 demo pages, the general loading time is about 2 to 3 seconds for each page without using WP Super Cache. With the WP Super Cache turned on, the page can be loaded within one seconds.
When the Azure App service is used with a Godaddy database, the loading speed for the same page will become 10 seconds. I suspect that if a remote database is used, the frequent database query will significantly reduce the WordPress website.
Another important issue with IIS 8.0 configured with above procedure is that the ASP.Net support has not been configured. In order to support ASP.Net website, you must follow this article to enable ASP.Net: IIS 8.0 Using ASP.NET 3.5 and ASP.NET 4.5
Comments
Post a Comment