I developed on an apache, now I need to deploy on ngix and I ran into some difficulties. Because inline-styles are disabled in my project (with cakephp) and there are some colours defined in the database, I made the RsrcController generating the css with the colours into a template.
Calling this function works only if I don't use the file extension .css, but just the slashed Url with controller and function.
If I append the file ending .css, nginx is searching in the webroot folder and returns a 404.
This is the relevant part of the config:
location / {
try_files $uri $uri/ /index.php?$args;
}
#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
I tried to find a solution adding another location rule like this:
location ~ rsrc/css_vars/~.css {
... [->second part of my question]
}
I dont want to pass all .css files to php. just those i expect to be dynamic generated. Anyhow, my changes dont seem to work.
Second part:
Cakephp works following way: http://url.com/controller/function/var1/var2/varx My contoller is rsrc. My function is css_vars. Than there are some vars (user...) and at the end I need the ".css".
I thought of rewriting the URl to the same but without the file extension ".css". Is there any way to come around regular expressions?