October 14

Leverage browser caching and add expires headers for Azure hosted WordPress

After a recent move to Azure, I was doing some performance testing for this blog via gtmetrix.com.  My reports were suggesting to ‘leverage browser caching’ and ‘add expires headers’ to improve my performance gradings.

Add expires header


Leverage browser caching

This is usually straight forward to implement; it is simply a few lines added to the sites .htaccess file – either manually or by one of the many WordPress plugins that will update it for you:

htaccess file

Even after this was implemented, I noticed that it wasn’t making any difference to my performance reports – which got me thinking about Azure and that it would be running IIS in the backend and not Apache – and of course IIS doesn’t use the .htaccess file, it uses web.config instead.

After reading a few articles about translating .htaccess content to web.config, I was ready to go.  Using FTP, I edited the web.config file in my root directory and added the following lines:

 

<configuration>
  <system.webServer>
    <staticContent>
       <clientCache cacheControlMaxAge="28.00:00:00" cacheControlMode="UseMaxAge"/>
    </staticContent>
         <caching>
            <profiles>
                <add extension=".php" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:01:00:00" />
                <add extension=".ttf" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
                <add extension=".gif" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
                <add extension=".jpg" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
                <add extension=".png" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
                <add extension=".js" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
                <add extension=".css" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
            </profiles>
        </caching>
 </system.webServer>
</configuration>

 

The configuration forces files to be cached on the client side for 28 days, except the .php files, which is only 1 hour.  I re-ran the performance grading reports and received a much better score!

Useful links:

Category: Geek, Tools | LEAVE A COMMENT
October 7

Generic Cisco icons Visio stencil

Switch

I can never find the generic Cisco Visio icons when I need them – the product specific ones are well documented on the Cisco support website – however the generic ones that I often need for logical or conceptual diagrams always seem hard to locate. So I’m posting them here so I can find them in future and to help out anyone else who needs them – I don’t believe there are any restrictions on their distribution.

Download here.

 

 

Category: Tools | 2 Comments
October 3

Huge WordPress wp_wps_logs database table

Recently while cleaning up my WordPress database, I noticed that the wp_wps_logs table was over 470MB in size. After a bit of research, I realised this was due to an old plugin that I once used – iThemes Security (formerly Better WP Security). I no longer used this so I needed to get the database size down.


Through cPanel, I opened myPhPAdmin.  On the left I navigated to the wp_wps_logs table then clicked on the Operations tab in the top right. Scrolling down to the bottom of the page, there is the option to Empty the table (TRUNCATE). Once I truncated the table, my database size was down to about 20MB!


wp_wps_logs table



Category: Geek | LEAVE A COMMENT
July 11

Free public SSL certificates

I recently needed to do some testing and needed to have a valid public SSL certificate and since it was only for testing, I preferred if there was no cost for this.
I came across StartCom – https://www.startssl.com/ – who offer FREE Class 1 SSL certificates.

These free certificates are Class 1 – meaning that there is minimal validation is done when they are requested and issued – however this is fine for testing but not really recommended for commercial use. From my testing, it appears that the issuing CA was automatically trusted by Internet Explorer and Chrome. These certs are perfect for testing over SSL.

For more info see the StartCom website – https://www.startssl.com/?app=40