if $request_uri [not static file], then ...

Joe Aston joe at joeaston.com
Sat Nov 8 16:30:50 MSK 2008


Thanks - that didn't work, but it at least pointed me in the right
direction (using location directives).

After 45 minutes of toiling with regular expressions, I've got the
following working (ish):

      location ~ ^/(js|css|images|etc) {
         root /var/www/domain.com/public;
         access_log off;
         expires max;
      }

The only problem is that within those folders I have scripts packaging
and compressing CSS and JavaScript i.e:

domain.com/js/compress.php?modules=this,and,that

So nginx pushes the SOURCE CODE of compress.php as a file to the
browser. Not good!

I'll have to rewrite my CSS and JavaScript compression scripts to run
as cron jobs writing to cached files (which I was going to do one day
anyway)

Unless there's an alternative?

On Sat, Nov 8, 2008 at 12:38 PM, Roxis <roxis at list.ru> wrote:
> On Saturday 08 November 2008, Joe Aston wrote:
>> Sorry, I did not make myself clear. I already have a fastcgi handler
>> section.
>>
>> I think the problem is with the regular expression in " if
>> ($request_uri !~* (js|css|images|etc)$) ":
>
> location / {
>    rewrite ^/(.+)$ /index.php?q=$1 last;
> }
>
> location ~ (js|css|images|etc)$ {
>    ...
> }
>
> location ~ \.php {
>    ...
> }
>
>





More information about the nginx mailing list