Monthly Archives: June 2016

Speed Up Your WordPress with Caching

Hey Skuligans & Amature Webmasters:

today’s instalment deals with speeding up your Skule wordpress website. While half the battle is on my (the sysadmin’s) side  – providing decent hardward, up-to-date OS, tweak webserver settings, blah blah – the other half of the battle is ensuring your site is well-optimised by design.

That’s where caching comes in. Each time a user loads a non-cached webpage, the webserver must re-generated the HTML code of your WordPress from raw PHP. Caching, on the other hand, takes the generated HTML and stashes it away for the next time a visitor clicks on your site. While the servers we have contain fast processors, no matter how you slice it, having to do less processing will always be faster.

Enabling Caching

Big Caveat: only attempt this if you have some experience with WordPress before. Unexpected errors can and will pop up for you, so only attempt if you are confident!

Luckily for you, WordPress provides its own set of caching plugins. The two best are the W3 Total Cache plugin,  and the WP-Supercache Plugin.  For Skule usage, the W3 plugin works best right out of the box; the Supercache Plugin requires more configuration. So, lets get installing the W3 Total Cache plugin:

  1. Go to the Plugins page,  click ‘Add’, and search + select the W3 Total Cache plugin from the plugin store
  2. Enter your FTP password to begin installation. If installation fails, check you have write permissions for your wp-content and wp-content/plugins folder. This can be done via Cpanel File Manager.
  3. Once installation is done, you may be greeted about some post-installation items that failed. These are permissions-related. Follow the instructions, and enable write permissions on the files that failed. This can be done via the Cpanel File Manager:
    perms
  4. Once done, enable all the caching modules you desire. The ones you definitely want are Page Cache, Object Cache, Minify Cache, and Database Cache. Unless you know what you are doing, don’t enable any others!
    enable
  5. Make sure to change back permissions on any of the files you changed in step 3!
  6. Caching should now be installed. Load you site to prime the cache; the first load is usually very slow.

Since caching is now enabled, you will have to clean your cache every time you create a new website post; this is done by clicking the ‘Performance’ tab on your WordPress topbar and selecting ‘Empty All Caches’.

Last note: you may have to edit your .htaccess file in public_html folder to allow redirects. You will know if you get “page not found” when click around your site. If so, you need to add this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Performance Gains & Testing Your Site

Now that caching is up and running, it’s time to test. Pingdom has a great tool for this.

Check it! Here is this site BEFORE caching:

precache

…And here it is AFTER caching:postcache

That’s a change from 703ms before to about 394ms —  close to 50% time reduction! Now go, and set up a cache on your site.

spam

Eliminate Spam, Threats with WordPress Plugins & Updates

Dealing With Spam

WordPress is just as vulnerable to spam as email — in fact, more so, because the control of spam filters is put entirely in your (the end users’) hands.  A prime example of why you want to install spam filters for your WordPress comments was a site I just worked on:

spam

For those who can’t see it yet:
spam

That’s right 1981 pending comments — and over 99% of them are spam. Truly a way to learn via the school of hard knocks. A quick way to limit your Skule website’s spam comments (and make it easier to publish valid comments) is use the WP-Spamshield plugin:

https://wordpress.org/plugins/wp-spamshield/

Simply install, and keep up to date, and your comments will be spam-free.

Another helpful plugin which will outright ban bad IPs, and keep tabs on spammy visitors is Wordfence:

https://en-ca.wordpress.org/plugins/wordfence/

Dealing With Viruses & Hackers

WordPress  – like any software – needs to be kept up to date (here’s looking at you, <insert-lazy-club-webmaster-name-here> !) or you risk having hackers break into your site by exploiting  vulnerabilities. It’s not hard, and its necessary, if only to keep me (your humble sysadmin) and the webmaster from pulling our hair out a few times each month.

It’s really quite a simple process:

  1. Log into your wordpress
    login
  2. Click on the updates button
    update
  3. Click upgrade/install
    reinstall
  4. Enter your FTP credentials Note that you MUST use localhost as the hostname!
    ftp
  5. Upgrade & Enjoy!
    maint