Lately I'm playing with the Nginx webserver. Nginx is a free, open-source, high-performance HTTP server hosting 7.5% of all webservers on the internet .
CakePHP plugin assets are served through PHP, which makes it obviously slower than serving it without invoking PHP. I found a little solution that speeds up every plugin asset by ~ 60ms. So when you have lots of images, css and javascript files in your plugin, you can speed up your page load time by several seconds!
One of the great benefits is the freedom and flexibility of the configuration files, so I played a bit with the 'try_files functionality' which results in amazing performance improvements. Of course I'm willing to share it, feel free to comment/critize it;
# Serve CakePHP plugin assets directly
location ~ {
access_log off;
expires 10d;
add_header Cache;
try_files $uri $uri;
}
You can find my full configuration example in my github repo:
https://github.com/Lennaert/Lennaerts-Snippets
For a full Nginx / PHP / CakePHP setup I could truly recommend the blog post of Kevin van Zonneveld and Chris Hartjes, I learned a lot from them!
