GridFS Nginx comprueba si existen datos

I use (File System Based) static html files for caching, for some reasons i don like this. I want store cache files (html, images) in database.

Now it work like that:

if nginx can get cache:
    return cache to user
    proxy_pass request to backend server

It looks like this in my Nginx config file

if (-f $cache_dir_prefix/$query) {
    rewrite (.*) $query break;

if (!-f $cache_dir_prefix/$query) {
    proxy_pass http://lionyzer;

It's posible to do IF check with GridFS Or Amazon S3 or Mysql or anything alse?

Muchas gracias


location /assets/ {                                                                             
    gridfs assets field=filename type=string;                                            
    error_page 404 = @scale;                                                                    

location @scale {                                                                               
    include fastcgi.conf;                                                                       
    fastcgi_pass unix:/tmp/php-fpm;                                                             
    fastcgi_param SCRIPT_FILENAME scaleme.php;                  

preguntado el 08 de noviembre de 11 a las 16:11

One more Good answer is here -

1 Respuestas

Puede utilizar el nginx-gridfs module to serve GridFS files directly from Nginx, and then catch a 404 for files not found and proxy those to the other server.

respondido 08 nov., 11:20

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.