Hello guys
I'm trying to redirect any JS or CSS files to a PHP minifier outside the root folder but it won't work. JS and CSS files are still delivered UN-minified as if they were plain static files.
Here is the directory structure on the Ubuntu 12.10 server:
+ /var/www/www.signora.co.nz/
+ /lib/
+ /www/
+ /var/
And here the nginx code. Scroll down to '------->' and you will see what my problem is.
server {
server_name www.signora.co.nz;
root /var/www/www.signora.co.nz/www;
index index.php;
access_log /var/www/www.signora.co.nz/var/log/nginx/access.log;
error_log /var/www/www.signora.co.nz/var/log/nginx/error.log warn;
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php;
}
location ~* \.(css|js) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
# ------> Here is the problem! It looks like this PHP file is never run
fastcgi_param SCRIPT_FILENAME /var/www/www.signora.co.nz/lib/other/smartoptimizer/index.php;
include fastcgi_params;
}
location ~* \.php {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
}
}
Hope anyone can explain? Thanks a lot ...
Cheers
Michael