AdminsForum

CloudPanel Varnish Cache & Performance Guides

Guide CloudPanel Cron Jobs, Logs and Varnish Cache: Complete Guide

Started by JAY 0 replies 6 views
1JAY
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
#1
CloudPanel cron jobs, logs and Varnish Cache

Three tools you'll use on every CloudPanel site: cron jobs for scheduled tasks, the Logs tab for troubleshooting, and Varnish Cache for fast page loads. Tested on CloudPanel 2.5.4, Ubuntu 24.04.

Part 1: Cron jobs
Open the site's Cron Jobs tab and click Add Cron Job. The Template menu fills in common schedules for you, from every minute to once a month, or you can type the five fields yourself: minute, hour, day, month and weekday.
g6 01 ae47   

Example: a real cron for WordPress. WordPress's built-in cron only runs when someone visits the site. Run it every 5 minutes with real cron instead:
  • Template: Every 5 minutes (
    Code:
    */5 * * * *
    )
  • Command:
    Code:
    php /home/SITE_USER/htdocs/YOUR_DOMAIN/wp-cron.php > /dev/null 2>&1
g6 02 ae48   

Then add this line to wp-config.php so WordPress doesn't also run it on page loads:
Code:
define('DISABLE_WP_CRON', true);

The job is saved and runs as the site user, with exactly the same permissions as the website.
g6 03 ae52   

Part 2: Logs
When something breaks, open the Logs tab. Choose the source (NGINX or PHP), the file (access or error) and how many lines to show, then click Update.
g6 04 ae50   

Each access-log line is one request: time, visitor IP, URL and status code. In our screenshot, a bot was probing for .env files (which can contain secrets) minutes after the site went live. That's normal on the internet, and a good reason to block bad bots in the site's Security tab.

Troubleshooting tip: for 500 errors or blank pages, check the PHP error log first; for 404s and redirects, the Nginx access log.

Part 3: Varnish Cache
Varnish stores finished pages in memory, so repeat visitors are served without running PHP at all. It's off by default; switch it on per site in the Varnish Cache tab.
  • Cache Lifetime: how long pages are kept.
  • Excluded Params: requests with these parameters bypass the cache (for example sessions).
g6 05 ae39   

When to use it: Varnish is a big win for blogs and content sites. For shops and member areas, test carefully: logged-in pages must never be cached for everyone. For WordPress, CloudPanel's CLP Varnish Cache plugin clears the cache when you publish.

Questions? Ask in CloudPanel Varnish Cache & Performance Support.

CloudPanel guide series
  1. What is CloudPanel? Complete overview
  2. CloudPanel system requirements
  3. CloudPanel features: the complete list
  4. How to create a PHP site
  5. How to install free Let's Encrypt SSL
  6. How to install WordPress (one-click)
  7. Databases, users and phpMyAdmin
  8. SSH, SFTP, FTP and File Manager
  9. Cron jobs, logs and Varnish Cache (you are here)
  10. Backups, firewall and Basic Auth
Reply

Messages In This Thread
CloudPanel Cron Jobs, Logs and Varnish Cache: Complete Guide - by JAY - Yesterday, 01:10 PM

Users browsing this thread: 1 Guest(s)
Forum Jump: