0

I'm trying to save the output of a fastcgi, but I seem to be getting a blank output.

If a user requests a file like /thumbnail/someuniquefilename.jpg and the file exists, it should just serve it. If it doesn't exist, it should fetch it via fastcgi with custom GET query string. So, I have something like this as of now:

location ~ ^/thumbnail/ {
    root /var/www/html;
    expires 24h;
    error_page 404 = @fetchthumbnail;
}
location @fetchthumbnail {
    fastcgi_pass    php;
    fastcgi_store   on;
    fastcgi_store_access    user:rw group:rw all:r;
    fastcgi_temp_path   /var/www/temp;
    fastcgi_param SCRIPT_NAME /var/www/html/thumbnailer.php;
    fastcgi_param QUERY_STRING src=/actual/path/$request_filename;
}

But I seem to be getting a blank page as a result.

Response headers:

Accept-Ranges:bytes
Cache-Control:max-age=86400
Connection:keep-alive
Content-Length:0
Content-Type:image/jpeg
Date:Sat, 29 Mar 2014 09:11:30 GMT
ETag:"53368d3d-0"
Expires:Sun, 30 Mar 2014 09:11:30 GMT
Last-Modified:Sat, 29 Mar 2014 09:07:09 GMT
Server:nginx/1.4.5

I've made some additional tests. And it appears the thumbnailer.php is not actually being run. Thus, the blank response.

Error logs only shows that thumbnail/someuniquefilename.jpg wasn't found since it really doesn't exist (or deleted after trial).

Grumpy
  • 2,979
  • 18
  • 23

1 Answers1

0

Apparently it's SCRIPT_FILENAME not SCRIPT_NAME.

Grumpy
  • 2,979
  • 18
  • 23