使用Nginx fastcgi_cache php-fpm缓存和静态文件缓存配置?

Nginx维基非常模糊,解释如何正确设置NginxPHP-fpm与fastcgi_caching为具有cookie的网站,即wordpress,drupal,vbulletin等.

我从http://vbtechsupport.com/796/下载了一个名为centmin的修改后的Nginx bash shell安装脚本,同时它通过shell脚本自动安装Nginx v1.0.2,PHP 5.3.6 PHP-fpm,mariadb 5.2.6 MysqL,memcached 1.4.5服务器和siege基准测试缺少用于为缓存PHP设置fastcgi_caching的配置参数.

它还缺少为本地提供的文件缓存静态文件的设置.将静态文件驻留在同一磁盘上时,使用proxy_cache是​​否有任何意义?

任何人都有一些提示和信息链接信息阅读教程正确设置PHP(PHP-fpm)fastcgi_caching以及缓存本地驻留静态文件

谢谢

最佳答案

Is there any point in using proxy_cache for static files when they reside on the same disk ?

没有,没有.它可以通过磁盘访问静态文件.

Anyone got some tips and info links to info to read up on tutorials for proper setup for PHP (PHP-fpm) fastcgi_caching as well as for caching locally residing static files ?

看看那里的各种proxy_caching教程,特别是那些从Apache代理wordpress的教​​程 – fastcgi_caching几乎完全相同,而且对于proxy_caching来说,几乎无疑对fastcgi_caching也有效.

我现在碰巧正在研究这个完全相同的问题.到目前为止,除了会计cookie之外,我还有它的工作,但这只是一系列简单的if指令,用于为fastcgi_cache_key指令设置其他变量. This page对你来说应该是非常有用的;只需跳到proxy_caching配置并将所有这些proxy_ *指令更改为fastcgi_ *(这是我一直关注的,但要注意if is evil并且不应该驻留在location指令中……).

当我完全自己完成后,我会在我的博客上发布它(链接在我的个人资料中;如果我把这个链接放在我的帖子中,我会再遇到麻烦).很遗憾,还没有任何fastcgi_caching指南已经存在,所以我不能指出你除了我的博客以外的任何东西(即使它还没有到那里……).

编辑添加:这是我当前的fastcgi_caching配置.就像我说的那样,它缺乏对cookie的任何解释,但它确实在很大程度上实际上是功能性的.

在处理我的.PHP文件的位置块中,我添加了:

#Caching parameters
fastcgi_cache one;
#I use host here to account for the fact that I have multiple WP instances
fastcgi_cache_key $scheme$host$request_uri;

fastcgi_cache_valid  200 302 304 30m;
fastcgi_cache_valid  301 1h;
fastcgi_cache_valid  any 5m;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;

这与我在http块中添加内容有关:

# configure cache log
log_format cache '$remote_addr - $host [$time_local]  '
                 '"$request" $status $upstream_cache_status $body_bytes_sent '
                 '"$http_referer" "$http_user_agent"';


# Configure cache and temp paths
fastcgi_cache_path /var/cache/Nginx levels=1:2
                   keys_zone=one:100m
                   inactive=7d max_size=10g;
fastcgi_temp_path /var/cache/Nginx/tmp;

相关文章

Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一...
本地项目配置 1 复制 luffy/settings/dev.py为prop.py 修改l...
nginx不仅可以隐藏版本信息,还支持自定义web服务器信息 先看...
一 、此次漏洞分析 1 nginx HTTP/2漏洞 [nginx-announce] ng...
###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...