Thursday, February 13, 2014

Serving assets from nginx static server in cakephp 2.x

Hi, 

I'm trying to serve my cakephp assets from a nginx static server.

The problem is that cakephp make assets urls lowercase and the url to nginx static server is not correct because nginx is serving the real path to the file like /Plugin/PluginFolderName/.../myasset.js

I tried it in vhost nginx configuration:

# Serve CakePHP plugin assets directly
location ~ /(.+)/(img|css|js|files)/(.*) {
  access_log off;
  expires 10d;
  add_header Cache-Control public;
  try_files $uri $uri/ /../Plugin/$1/webroot/$2/$3 /../../Plugin/$1/webroot/$2/$3 /index.php?url=$uri;
}

Changing in cakephp to uppercase the first letter on asset url works but only with the Plugins that are not CamelCased.

How could i solve this?

Thank you very much

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: