Hosting performance tweaks, Opcode caching, expires headers and gzip compression

Hosting Performance Tweaks

Let's look at some of the key optimization techniques that could help you get the best performance out of your website, whether it's built under WordPress or any other Content Management Systems.

Caching is very important if you like to speed up your website. By implementing some good caching techniques you can improve the performance significantly. We will review some of the most effective caching techniques.


Opcode caching essentially works by compiling PHP in to pre-compiled bytecode, so PHP doesn't need to be re-interpreted on every single request. It is especially good at speeding up large applications with lots of includes/require statements. Generally speaking, you can take a page loading speed from several seconds down to less than 500ms by enabling the opcode caching. You can do this in cPanel under 'PHP version' then find the tickbox next to 'opcache' and make sure that's enabled.

One reason you may not want to enable opcode caching is during development or debugging; so during this process you may wish to disable opcode caching but on the whole it is recommended to leave it enabled.

WordPress Caching Plugins

To cache your WordPress posts and pages as static files you can can use some caching plugin. Installing a caching plugin in WordPress is fairly simple, and is just a case of going to the wp-admin -> Plugins -> Add New. Then enter the name of the plugin you'd like to install. There are many caching plugins out there, and your experience of them really depends on your theme and mix of plugins you're currently running. It can be a case of trial and error to see what works best for your site. The three best to look at are:-

  • WP SuperCache
  • W3 Total Cache
  • WP Rocket

Please don't install or activate morethan one at the same time though - you'll probably cause a conflict that could slow down performance.

Leverage Browser Caching

Another caching technique that you can implement is called Browser Caching. Browser caching means the client’s web browser will download and store static assets like CSS, JS and images into the local storage for a certain amount of time, which can reduce the number of requests for each page and will greatly reduce the server load. To enable browser caching simply add the lines below into your .htaccess file:

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/jpg "access plus 1 year"

ExpiresByType image/jpeg "access plus 1 year"

ExpiresByType image/gif "access plus 1 year"

ExpiresByType image/png "access plus 1 year"

ExpiresByType text/css "access plus 1 month"

ExpiresByType application/pdf "access plus 1 month"

ExpiresByType application/javascript "access plus 1 month"

ExpiresByType application/x-shockwave-flash "access plus 1 month"

ExpiresByType image/x-icon "access plus 1 year"

ExpiresDefault "access plus 2 days"


Gzip compression

Gzip compression is necessary in order to decrease the size of data that is being sent from your server. Enabling Gzip compression is fairly easy, just add the lines below into your .htaccess file:

<ifModule mod_gzip.c>

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_gzip_item_include file .(html?|txt|css|js|php|pl)$

mod_gzip_item_include handler ^cgi-script$

mod_gzip_item_include mime ^text/.

mod_gzip_item_include mime ^application/x-javascript.

mod_gzip_item_exclude mime ^image/.

mod_gzip_item_exclude rspheader ^Content-Encoding:.gzip.*


Optimizing images

Many website owners who have this problem aren’t even aware of it. But knowing how to optimize images in WordPress can make all the difference. Beyond losing visitor interest, having large images can result in pages load slowly, than expected and furthermore, decreasing your SEO (Search Engine Ranking). If your website is built around WordPress, there are plugins, which have been built just for this, one of which is WP Smush. Generally speaking, images should be less than 500KB, so make sure to double check the sizes when uploading, and ensure you're using an appropriate resolution.

Minify CSS and JavaScript files

Minifying means removing white space, line breaks and so on from javascript and css files. It makes them much smaller to download and process. If you are running WordPress, there are plugins that will automate the minification process for you like W3 Total Cache.

  • expires headers and gzip compression, Hosting performance tweaks: Opcode caching
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

HTTP 2 Implemetation

HTTP 2 Overview HTTP/2 is a major revision of the HTTP/1.1 network protocol used by the World...

Changing your PHP Version in cPanel

How to change your PHP Version in cPanel Because we run CloudLinux, we are able to provide a...

Adjusting your PHP Options

Adjusting Your PHP Options Let's look at the steps needed for adjusting some of your PHP Options...

Cron Jobs

Cron Jobs Cron is a utility, implemented in Linux, which schedules a command or script on your...

WordPress Caching

WordPress Caching Caching involves taking dynamic elements of your site and creating a static...

Powered by WHMCompleteSolution