Thumbnails not generated with Kirby CMS on CloudPanel

Nemesis

Active member
Joined
Mar 22, 2025
Messages
35
Points
61
Age
26
I’m hosting multiple Kirby websites using CloudPanel on a Debian 11 server with Apache. Everything runs smoothly except for one critical issue:
Thumbnails are not being generated.
There are no errors in the logs. However, Kirby reports missing media files when I visit pages that should display images.
Here's what I’ve tried so far:
  • Both ImageMagick (v7.1) and GD (2.3) are installed and enabled for PHP 8.1.
  • Permissions are set to 755 for folders and 644 for files.
  • File ownership is siteowner:siteowner, as per CloudPanel defaults.
  • Thumbnails from the Blurry Placeholder plugin are generated correctly.
  • The /usr/local/bin/convert binary exists and works when executed manually.
  • I’ve tried setting both GD and ImageMagick drivers in config.php, but thumbs still don’t generate.

Have you seen this before?
 
Solution
If you're calling thumb() but still not seeing results, here’s one last thing that tripped me up:

CloudPanel's Nginx/Apache config may block access to image types​

Check if you have this block in your Nginx/Apache config:

Code:
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|svg|webp|...)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;
}

It may silently block dynamic image requests like thumbs. Try commenting it out or making sure it doesn’t interfere with Kirby’s /media folder.
Yes, I’ve run into this exact issue when deploying Kirby with CloudPanel. It can be tricky because everything looks fine but thumbs silently fail.
Here’s what I’d recommend:
  1. Test exec() inside Kirby
    Add this to a template to see if exec() actually works:

    Code:
    exec('whoami', $output, $retval);
    dump($output);
    dump($retval);
  2. Check if your PHP user can run convert
    Even if convert works from your shell, the PHP user (usually siteowner) might not have execution permission. Try running:

    Code:
    su - siteowner
    convert input.jpg output.png
 
I tested exec('whoami') from a Kirby template—it returns siteowner, which is correct. Also, running convert directly as siteowner works just fine.
Still, Kirby doesn’t generate thumbnails even though the Placeholder plugin does. Could it be a driver problem?
 
Good job narrowing that down.

Yes, it might be related to how Kirby’s thumb generation is triggered. A few more things to check:
  1. Make sure Kirby is actually calling the thumbs method.
    In your template, I noticed you’re using:

    Code:
    <img src="<?= $image->placeholderUri() ?>" data-src="<?= $image->url() ?>" />
    This loads the original image, not a generated thumb. Try changing to:

    Code:
    <img src="<?= $image->thumb()->url() ?>" />
  2. Thumbs are generated only when the URL is called.
    Make sure the image URL is actually accessed from the browser at least once.
 
You’re right—I was never explicitly calling the thumb() method in my templates. I’ve updated the template to use it directly.
However, I still don’t see the generated thumbnails in the /media folder, even after visiting the image pages.
 
If you're calling thumb() but still not seeing results, here’s one last thing that tripped me up:

CloudPanel's Nginx/Apache config may block access to image types​

Check if you have this block in your Nginx/Apache config:

Code:
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|svg|webp|...)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;
}

It may silently block dynamic image requests like thumbs. Try commenting it out or making sure it doesn’t interfere with Kirby’s /media folder.
 
Solution
Boom. That was it.

There was a broad location rule in the Nginx config that unintentionally blocked access to the dynamically generated files. Once I adjusted it, thumbs started working perfectly — both in the Panel and frontend.

Thanks again, Rootali. You saved me hours of frustration.
 
Anytime, Nemesis. Glad it’s sorted!
CloudPanel is powerful but needs a bit of tweaking for things like Kirby.
Let me know if you run into anything else!
 
Back
Top