1
我使用(基於文件系統)的靜態html文件進行緩存,出於某些原因,我不喜歡這樣。我想在數據庫中存儲緩存文件(html,圖像)。GridFS Nginx檢查數據是否存在
現在的工作就像是:
if nginx can get cache:
return cache to user
else
proxy_pass request to backend server
它看起來像這樣在我的Nginx的配置文件
if (-f $cache_dir_prefix/$query) {
rewrite (.*) $query break;
}
if (!-f $cache_dir_prefix/$query) {
proxy_pass http://lionyzer;
break;
}
它的更多鈔票做的,如果檢查有GridFS的或Amazon S3或MySQL或任何ALSE?
非常感謝
,答案是
location /assets/ {
gridfs assets field=filename type=string;
mongo 127.0.0.1:27017;
error_page 404 = @scale;
}
location @scale {
include fastcgi.conf;
fastcgi_pass unix:/tmp/php-fpm;
fastcgi_param SCRIPT_FILENAME scaleme.php;
}
還有一個好的答案在這裏https://github.com/mdirolf/nginx-gridfs/issues/10 – derevo