I’ve just installed a plugin, and I get the following error when loading the Panel. This is particularly odd as entering the url loads the page correctly.
The specific plugin installed is Retour by @distantnative, but as far as I know there is not a recommended Nginx setup for kirby… maybe this is the source of the issue? I have never encountered such an error before.
That does not seem to cut it. I have updated my Nginx config as per Bastian’s suggestion, but to no avail. What is strangest is that the response seems fine, but throws a 404 status code, as you can see by loading the following page:
I could not fully understand why this is the url that gets loaded, as there is no index.js file in /media/plugins/, and usually files in the media folder have a hash, such as:
Indeed that’s what I’ve come to understand. Thankfully the Kirby core is well documented.
Any idea how I could inject some debugging code? Maybe fiddling with /kirby/config/routes.php? My nginx log only tells me that there is no such file, but really it should be loading index.php, right?
No, that does not work either. Here’s the full error log from Nginx if that helps. It seems the error is triggered even before it gets to the index.php bit.
Adding the following line to my Nginx config solves the issue, but then all the images break, so that’s not ideal:
rewrite ^/media/(.*)$ /index.php?$1;
I’m thinking maybe I should just go back to the old Apache…
EDIT: I’ve removed the full error log for security reasons, but look at the solution below for the relevant lines that helped solve the problem.
Maybe dig around in Valet… thats Nginx based and kirby runs fine on that. Maybe if you dig into the Valet files and find the master Nginx config and the Kirby driver file, that will help you fix your own Nginx config.
I’m glad you were able to fix it. We still need a better Nginx default config, but I’m not an Nginx expert to be quite honest and I don’t want to give wrong advice.