Welcome! Log In Create A New Profile

Advanced

... redirect JS or CSS to a PHP minifier.

Posted by michael.heuberger 
... redirect JS or CSS to a PHP minifier.
December 06, 2012 03:29AM
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
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 101
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready