OpenLiteSpeed is a high-performance event-driven open source web server developed and maintained by LiteSpeed Technologies. In this article, we will see how we can use CyberPanel to get up and running with LSCache and WordPress on OpenLiteSpeed in few clicks.
What is LSCache?
LSCache is a full-page cache built directly into OpenLiteSpeed web server, it is similar to Varnish but more efficient because we remove the reverse proxy layer from the picture when LSCache is used.
LSCache WordPress Plugin!
LiteSpeed has also developed a WordPress plugin that communicates with OpenLiteSpeed web server to cache the dynamic content which greatly reduces the load time, increases performance and puts less load on your server.
LiteSpeed’s plugin provides powerful cache-management tools that, due to LSCache’s tight integration into the server, are impossible for other plugins to replicate. These include tag-based smart purging of the cache, and the ability to cache multiple versions of generated content based on criteria such as mobile vs. desktop, geography, and currency.
LSCache has the ability to cache personalized copies of a page, which means that caching can be extended to include logged-in users. Pages that are publicly uncacheable may be cached privately.
In addition to LSCache’s advanced cache-management capabilities, the WordPress plugin also provides additional optimization functionality such as CSS/JS minification and combination, HTTP/2 Push, lazy load for images and iframes, and database optimization.
What is CyberPanel?
CyberPanel is a control panel on top of OpenLiteSpeed, you can use it to create websites and install WordPress with one click.
It also features:
- FTP
- DNS
- Multiple PHPs
In this article, we will see how we can efficiently make use of all of these technologies to get up and running in no time.
Step 1: Install CyberPanel – ControlPanel
1. The first step is to install CyberPanel, you can use the following commands to install CyberPanel on your Centos 7 VPS or dedicated server.
# wget http://cyberpanel.net/install.tar.gz # tar zxf install.tar.gz # cd install # chmod +x install.py # python install.py [IP Address]
After successful CyberPanel installation, you will get login credentials as shown below.
################################################################### CyberPanel Successfully Installed Visit: https://192.168.0.104:8090 Username: admin Password: 1234567 ###################################################################
2. Now login into CyberPanel using above credentials.
Step 2: Install WordPress in CyberPanel
3. To setup WordPress with LSCache, first we need to create a website by going to Main > Websites > Create Website section and fill out all details as shown.
4. Now go to Main > Websites > List Websites section, click on Launch icon to launch the website panel, so that WordPress can be installed.
Once the website panel is launched you will have the following options on your screen:
5. On this window, open File Manager and delete everything from the public_html folder. Now scroll down to the bottom and you will see a tab which says WordPress with LS Cache.
6. In the path box do not enter anything if you want WordPress to be installed in the website document root. If you enter any path it will be relative to the website home directory.
For example, if you enter wordpress, your WordPress installation directory will be tecmint.com/wordpress.
7. Once you click on “Install WordPress“, CyberPanel will download WordPress and LSCache, create the database, and setup a WordPress site. Once CyberPanel is finished installing WordPress you will need to visit your website domain to configure your website.
In this example we’ve used tecmint.com, so we will visit this domain to configure our site. These are very basic settings and you can follow the onscreen instructions to complete your configurations.
Step 3: Activate LiteSpeed Cache Plugin
8. Once WordPress is installed, you can login to the dashboard at https://tecmint.com/wp-admin. It will ask for the username/password combination that you set up during wordpress configuration.
The LSCache plugin is already installed, so you just need to go into Installed Plugins in your WordPress dashboard and activate it.
9. Now verify LSCache by going to example.com and see your responce headers will look something like.
You can see that this page is now served from cache and the request didn’t hit the backend at all.
Step 4: Advance LiteSpeed Cache Options
- Purge Cache – If for some reason you want to purge the cache you can do so via the LSCache. On this page you have numerous ways to purge the cache.
Minify, Combine, and HTTP/2 Push
- Minification – When code is minified, all unnecessary whitespace characters, newline characters, and comments are removed. This shrinks the size of the source code.
- Combination – When a website includes several JavaScript (or CSS) files, those files may be combined into one. This reduces the number of requests made by the browser and, if there was duplicate code, it is removed.
- HTTP/2 Push – This functionality allows the server to anticipate the browser’s needs and act upon them. One example: when serving index.html, HTTP/2 can reasonably assume that the browser also wants the included CSS and JS files, and will push them, too, without being asked.
All of the above measures give OpenLiteSpeed the ability to serve content faster. These settings can be found in the LiteSpeed Cache settings page under the Optimize tab, and they are all disabled by default. Press the ON
button next to each setting that you’d like to enable.
It is possible to exclude some CSS, JS, and HTML from being minified or combined. Enter the URLs to these resources in the appropriate boxes, one per line, to exclude them.
Step 5: Change Default PHP and Install Extensions
10. If, for some reason, you need to change the PHP version for your WordPress website you can do so via CyberPanel:
11. Some additional WordPress plugins may require you to install additional PHP extensions, or you may want to add Redis to WordPress. You can install missing extensions via CyberPanel from the Server > PHP > Install Extensions tab.
First select the PHP version from the drop down for which you want to install the extension. In the search box, enter the extension name, and finally click Install to install the missing extension.
For more information read CyberPanel and OpenLiteSpeed Documentation.