This is an old revision of the document!
How to Set Up Crawler Cron Job for LSCJoomla
Crawler Function
The latest LSCJoomla provides a crawler function at Advanced > Web interface to rebuild all LiteSpeed Cache:
Web interface to rebuild all LiteSpeed Cache: https://yourdomain.com/index.php?option=com_lscache&recache=5dcfad26ad657984064c731ee774a57f
Prerequisite for Crawler
To run the above crawler, your curl_exec
cannot be disabled in your php.ini
settings. Also you will need to enable the crawler feature on LSWS, which is most likely disabled on shared hosting server by default.
If curl_exec
was disabled from php.ini
, you may see an error similar to:
Warning: curl_exec() has been disabled for security reasons in /home/joomla/public_html/plugins/system/lscache/lscache.php on line 1564
If crawler feature is not enabled on LSWS, you may see an error like the following:
Run Crawler Once Manually
You can click the Web interface to rebuild all LiteSpeed Cache link to run the crawler manually. It will only run once until completion.
Run Crawler as Cron Job
To set up the crawler as a cron job, you can simply use wget to retrieve the cachelink URL (please replace the URL with your own value):
wget https://yourdomain.com/index.php?option=com_lscache&recache=5dcfad26ad657984064c731ee774a57f
For example, set up the above cron job daily to run at 0:00, in crontab -e user
:
0 0 * * * wget wget https://yourdomain.com/index.php?option=com_lscache&recache=5dcfad26ad657984064c731ee774a57
How to Keep the Page Cached More Often
The Homepage Public Cache TTL (minutes) setting defines how long before the cache will be expired. The default setting is 2000
minutes, which is around 33 hours.
To keep the page cached most of the time, you can either set a longer Time to Live (TTL) to make the cache valid for a longer time, or run the crawler periodically before the TTL is up and the cache expires. For example, for a 2000 minute TTL, running the crawler cron job daily will keep the pages cached all the time.