If you use Shared Web Hosting, almost certainly will use cPanel to manage. However, you know how to optimize the configuration to use cPanel hosting more effectively? Please refer to tips in this post.
cPanel is extremely popular in the world because it is easy to use and suitable for a wide variety of users. This article is based on Hawk Host‘s cPanel 64.0.20 interface, with other providers do the same.
Optimize PHP 7.1
Select the PHP version 7.1
Hosting providers often choose PHP 5.6 by default, as the version has been around for a long time, with higher compatibility with source code than PHP 7.0 or PHP 7.1.
However, if you are using WordPress, Joomla, Magento …, should select the PHP version 7.1 instead of PHP 5.6. Because these popular types of code are constantly updated, ensuring 100% compatibility with the latest PHP, of course in the condition you regularly update version.
According to some research studies, WordPress uses PHP 7 for performance performance three times higher than PHP 5.6. Another note, the current version of PHP 5.6 has stopped growing, only support dangerous security patches only. See also PHP Supported Versions.
Using PHP 7 is an inevitable trend, if your code is not well-compatible, my advice is to take the time to optimize, replace the deprecated functions, make the most of the power of PHP 7.
Most hosting providers allow you to switch between PHP versions. In cPanel, go to Select PHP Version.
Next select PHP Version 7.1 and press the Set as current button.
2. Activate some necessary extensions
PHP 7.1 comes with a number of extensions that improve the performance of your website, such as Zend Opcache, Memcached. If these extensions are not activated in cPanel then it is too wasteful.
Still in the PHP Selector | extensions page, click opcache and memcached options then click Save. See picture above.
Opcache is a very important extension that helps .PHP files do not need to be recompiled at runtime, increasing the processing and responsiveness speed of the website. Opcache just needs to active, no configuration needed. This extension is almost mandatory for you to activate when using hosting.
Memcached cache query, which helps reduce loading on MySQL Server, depending on which hosting provider supports this extension or not that you can activate. See also how to enable Memcached on Hawk Host.
3. Configure the necessary parameters
In addition to changing the default PHP version, you can also reconfigure PHP’s parameters to better suit your actual usage needs.
Still in the Select PHP Version page, click the Switch to PHP Options link. The parameters you are allowed to adjust will appear:
The parameters have been adjusted to be green, but the default is gray.
After the change, click Save.
Activate Let’s Encrypt
About 1/3 of the world’s sites have switched to HTTPS instead of HTTP, and the number is still increasing because of the benefits that HTTPS brings. It’s great that we can use SSL completely free, activated directly in cPanel with support from Let’s Encrypt.
By default, the certificate is activated for 3 months, but cPanel automatically renews you automatically, so after activation you are free to use forever, no worries anymore.
In addition to securing data transmission between users and servers, there is a huge benefit that many users do not notice when using Let’s Encrypt enabled via cPanel, which is HTTP2.
HTTP2 is an upgraded version of the old HTTP/1.1 protocol that was introduced in 1999, which we are using today. HTTP2 helps web pages load 3 to 10 times faster, longer “live” connections, faster content, and support for multiple parallel connections. Direct HTTP/1.1 experience with HTTP/2 here.
After enabling Let’s Encrypt, check the site load process using Developer Tools, you will see all image data, .js files, .css files have been transferred to the HTTP2 protocol. No further configuration is needed.
With so many benefits, there’s no reason to delay, so check that your hosting provider and activate Let’s Encrypt now.
Activate LiteSpeed Cache
The LiteSpeed Webserver is a perfect replacement for Apache, which is 900% faster than Apache for static data processing and up to 50% faster when handling PHP requests.
When using LiteSpeed, most vendors will enable the powerful caching LiteSpeed Cache, which behaves similarly to Apache’s mod_cache, but has the same powerful performance as the Varnish Cache.
Because of the server-level cache so LiteSpeed Cache will work better than application-level cache.
Activate LiteSpeed Cache with WordPress
Next is installing and activating the LiteSpeed Cache plugin:
The plugin will automatically enable the cache feature, so you can configure it further in the Settings section of the LiteSpeed Cache. The cache check does not work with the check header tool, the first time you request you can see the X-LiteSpeed-cache => miss, but the second request returns an X-LiteSpeed-Cache => hit. So LiteSpeed Cache works.
Activate LiteSpeed Cache with other platforms
With other platforms, if there is no corresponding plugin, you just add the code below to the top of the .htaccess file is done:
CacheLookup public on
Some vendors use LiteSpeed Webserver that supports cache as Hawk Host, StableHost, AZDIGI…
Optimized Browser Caching
Both Apache and LiteSpeed Webserver support .htaccess file, which you can use to optimize Browser Caching, require the browser not to reload static files, such as JS, CSS, images and other media files (pdf, Flash,…) whenever a request is made
Open the .htaccess file at the root category of your website, insert the following code:
For testing, you use the check header tool with a URL image or CSS file, if the header contains Cache-Control and Expires plus one month is successful:
Hopefully with this article, you will use more efficient hosting. If you know any other tricks, share them by leaving a comment below.