Install and Supercharge Drupal 8 With OpenLiteSpeed and LSCache!

Install and Supercharge Drupal 8 With OpenLiteSpeed and LSCache!

What is Drupal?

Drupal is a free and open source content-management system (CMS)/framework written in PHP. It’s content is all dynamic and responsive, meaning it works as well for big screen users as it does for mobile users without any issue. Drupal 6 and 7 were the earlier versions, but the latest version as of now is Drupal 8, which has better interaction and support for third party integrations as well. As it is portrayed on Drupal’s main website “Drupal 8’s core platform has more than 200 new features built in.”

In the competition of Content Management Systems, It comes 3rd in Popularity and number of downloads after Joomla in 2nd place and WordPress in 1st. CyberPanel has an integrated feature to install WordPress and Joomla with their respective LSCache plugins, directly using the Website Management Tools which facilitate your website hosted on CyberPanel and OpenLiteSpeed web server.

In this article, we will cover installing Drupal 8 on a website which is hosted on CyberPanel and further configuring the LiteSpeed Cache module for Drupal which is exclusively for OpenLiteSpeed installations. The LiteSpeed Cache module, with the help of advanced caching, serves the dynamic PHP pages as static HTML pages instead to reduce the server and database load in cases of high traffic. As a result, it tends to serve your content upto 4X Faster than normal! (See benchmarks at the end).

Step 1 : Create Website

Before starting the tutorial, It is assumed that you have installed CyberPanel on your dedicated server or VPS. If not, please read the documentation on how to install it on CentOS 7. After installing CyberPanel, let’s create our website!

From the left panel, click on Websites then ‘Create Website’ and enter your domain name. After the website has been created, we are ready to Upload Drupal on it.

Step 2 : Uploading Drupal on our Website.

For this article, we will be using the domain “talkshosting.com”, you will use your own domain at the time of setting up. Now that our website is created, we are ready to upload our contents on it!

Go to Drupal’s Download page and download the latest release from there in .tar.gz format.

Downloading Drupal

After the drupal-8.x.x.tar.gz file has been downloaded, upload it to your website via either Web File Manager or FTP. For uploading it via Web File Manager, you will need to raise the PHP upload limit, for which a tutorial has been made here. After changing those limits, restart OpenLiteSpeed from the Server Status -> Services status on the left sidebar.

To go to web file manager, go to Websites -> List Websites and Click the ‘Launch’ button next to your website.

Going to Website’s Settings

Inside the settings, scroll a bit down and click on ‘File Manager’, it will open your websites content with CyberPanel’s inbuilt file manager in a new tab. Now, click on the folder public_html and delete it. Now, upload the drupal-8.x.x.tar.gz which you had downloaded earlier through the file manager. After it has been uploaded, click on that file and Extract it by clicking Extract on top. The Drupal setup will be extracted in drupal-8.x.x folder. Rename that folder to ‘public_html’ so that the contents of our websites will be served from it. Drupal is now ready to configure. You can now also remove the drupal-8.x.x.tar.gz file!

Step 3 : Creating a Database for Drupal!

Now that Drupal’s files have been uploaded on our website, it is now ready to be configured before we shall use it. Before going to our website and configuring anything, Let’s create a database for Drupal to store its contents in!

For Creating a Database, go to the left sidebar of your CyberPanel and Click on Databases -> Create Database and enter your database name, the username to access it and its password. (Note : Please note the contents which are shown on the right hand side of the database name and user name fields somewhere else as well as we will need it for configuring Drupal further in the next step).

Creating a Database for Drupal!

Step 4 : Installing Drupal.

Go to your web domain now and Select your language. At the next step select Standard installation. After that, you’ll be asked for your database username, db name and password that you just created in the previous step. Enter it here.

Entering our Database information for Drupal to access

After that, click next and Drupal will install.

Drupal being Installed!

Now that Drupal is installed on your website, it will ask for Site name and other information. Enter it as you please. As we are using talkshosting.com for this process, we are entering the information that is needed for it.

Final Configuration

After you have completed this step, your site is now installed. Congrats!

Our site is now working, but you will notice that only the main page will work, if you try to browse anywhere else, you will be returned to a 404 page error. To fix this, we will now change the rewrite rules through CyberPanel itself.

Step 5 : Changing Rewrite Rules.

To change rewrite rules, let’s launch our Website again in CyberPanel like we did in Step 2.

Going to Website’s Settings

Scroll down to the Configurations section then click ‘Add Rewrite Rules (.HTACCESS)’. In that text area, delete everything stored previously, enter the following lines, and click Save Rewrite Rules.

After you have done this, your site will now work perfectly!

Step 6 : Installing LSCache module for Drupal on OpenLiteSpeed

As CyberPanel uses OpenLiteSpeed webserver, it comes with a module for Drupal for inbuilt caching as discussed above. Therefore, lets install the Caching module on our Drupal Installation!

You need to download that module on your local computer via This Link.

Now, go to your Drupal Installation, login to your admin account, go to Extend in the manage section. Click on Install Module at that page and upload the Drupal module which you just downloaded. The module will now get installed and you can enable it to have the effects of LiteSpeed Cache instantly!

Search for the plugins to install and Install LiteSpeed Cache!
Installing LiteSpeed Cache Module in Drupal 8

LiteSpeed Cache Plugin Configuration Options

After installing the LS Cache module, your site would be ready to serve the cached (static) content. However, inside the Module settings, there are a few options which can be configured according to your needs.

LS Cache Settings

From here, you can Clear Cache for your website. Note : the ‘Clear Cache’ option will clear the cache only for your Drupal installation but the ‘Clear All’ option will delete the cache for the entire domain which may consist of other applications running on the same domain such as WordPress/Joomla). Other options can be customized here like ‘Max age’ and ‘Max age private’ which defines for how long your website would be served as a Cached website ; after that age, the previous cache will be purged and the website will be cached once again.

If you are in a development environment, you can keep the Debug option on. Otherwise turn it off, if it is ready for production purposes, as it will stop emitting extra debugging headers for your Drupal website.

OpenLiteSpeed web server doesn’t supports ESI but LiteSpeed Technologies itself says that there’s no harm in keeping the ESI option turned on.

After configuring the above options, your website should be ready to serve cache content now. We will now do some benchmarking and the result can be found below!

Benchmarks!

Now that we have configured Drupal 8 on CyberPanel with LiteSpeed Caching enabled, lets see how it facilitates our website with the way we did it in this article, as compared to a standard Apache web server or an OpenLiteSpeed web server without LSCache module enabled.

Benchmarking Drupal 8 on Apache+NGINX Webserver

We generated traffic on our website with localhost via tool Apache Benchmark (AB) and the test was done for Apache web server with NGINX reverse proxy configured on the same server. (This configuration gives better results than standard Apache because NGINX serves static content and Apache serves dynamic content making it a bit faster than normal Apache in advanced uses).

Host node (KVM VPS) Specifications on which this benchmark was done :-

When we generated 5000 requests on our website with a concurrency rate of 500 users, the result was :-

As you can see, it is able to serve 110 Requests per second on this configuration.

Benchmarking Drupal 8 on OpenLiteSpeed webserver without LSCache

For this benchmark, we again generated traffic on our website with localhost and this time the test was done to examine the capability of OpenLiteSpeed webserver without LSCache enabled. This test was done on a standard 1 GB RAM 1vCore VPS whose specifications were :-

 

When we generated 5000 requests on our website with a concurrency rate of 500 users, the result was :-

In this VPS with the CyberPanel (OpenLiteSpeed webserver) installed, it is able to handle 115 Requests / second despite it being a comparatively slower Box than the one we previously used.

Benchmarking Drupal 8 on OpenLiteSpeed webserver without LSCache enabled.

For this benchmark, we again used the 1 GB Digital Ocean Droplet with CyberPanel and LSCache enabled (basically, what we did in the article). Upon generating 5000 requests on our website with a concurrency rate of 500 users, the result this time was :-

This time it was able to serve 415 requests/Second on this Box with the help of OpenLiteSpeed with caching enabled!

Conclusion

While it is surprising to say that the domain hosted on CyberPanel (or, OLS web server) with LiteSpeed Caching enabled on a LowEnd VPS is able to perform almost 4 times better vs. what a High-End VPS with Apache would perform, it is also shocking to know that Apache is still the most popular and most-used web server, when it isn’t as efficient! The traffic gets generated, and your server may even tend to crash but with OpenLiteSpeed web server, it is guaranteed that your server will be able to last much longer (wink, wink).


We hope you like the Benchmarks and will be able to set up Drupal 8 with LS Caching without any issues. If you did encounter any errors, feel free to ask on CyberPanel’s forums or the Discord server for any support related queries.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: