[Solved] Media are not generated


I didn’t touch my kirby site since a long time ago.
Today I would like to update my portfolio.

The path : /html/website/content/portfolio/project1, project2 etc…
Inside there is a project.txt and one picture.

Today, as usual, I create a new project folder : project31
I create my project.txt and add my image

I go to my website, 404 on the image, the text is here.

In media/pages/portfolio the folder project31 exist but inside there is no images generated (but there is the folder .jobs with the images)


Have you any clue please ?

I’m on kirby 3 I think.
No panel, only sftp.
Nginx for reverse proxy.


My porfolio.php didn’t change since a year :

I have not any plugin
My config.php :

My website is online this one year and I never encounter this issue

I tried to copy a previous content/portfolio/project to a new one, same behavior

My nginx conf :

I found the issue, is because of this part of Nginx conf :

When I comment it, the media are correctly generated
How I could adapt this to keep my Nginx cache please ?

Has something changed on the server, i.e different PHP version? Check with phpinfo() if gd is still enabled on the server. Might make sense to also check the php and server error logs.

Only one location is matched at any given time, so if that last block is found to be matching, the location / block is never run; just because ~* blocks have a higher priority.

Kirby needs to be invoked when the image does not exist, so it can generate it, respond with it and save it into the media folder. The next time a user requests the image, it’s already there and kirby can be skipped.

I think you should be able to do this by adding a try_files directive to the assets block.

location ~* \.(xml|ogg|ogv|svg|...)$ {
    try_files $uri /index.php$is_args$args;
    access log off;
    log_not found off;
    add header Cache-Control "public, no-transform";
    expires 365d;

So if the requested image doesn’t exist, the request is internally redirected to the ~* \.php$ location, if it is found the headers are added and the file is returned as is.

1 Like

It’s working perfectly
Thank you :pray:


you also want to block access to the content, site and kirby folders. Which, judging by the config I’m able to see is not happening. Otherwise people would be able to access, for example “/content/site.txt” and possibly get access to private data.

You also want to block access to hidden files (filename starting with a .), because you could, for example have a .git folder in your root, or you could have an .env file which you definitely don’t want to expose.
The only folder starting with a . you might want to expose is the .well-known folder (let’s encrypt might rely on that).

You would do this by adding the lines

rewrite ^\/(content|site|kirby)/(.*)$ /error last;
rewrite ^\/\.(?!well-known\/) /error last;

directly into the (ssl) server block.

You can read more about nginx configuration for Kirby here: Running Kirby on a Nginx web server | Kirby CMS

1 Like

Thank you a lot @rasteiner for your time !