Caching 如何为gunicorn夹层启用nginx代理缓存
我们的堆栈是在EC2实例上运行的nginx-gunicorn-mezzanine(django cms)。一切正常,但我似乎无法启用nginx proxy\u缓存。以下是我的最低配置:Caching 如何为gunicorn夹层启用nginx代理缓存,caching,nginx,gunicorn,mezzanine,Caching,Nginx,Gunicorn,Mezzanine,我们的堆栈是在EC2实例上运行的nginx-gunicorn-mezzanine(django cms)。一切正常,但我似乎无法启用nginx proxy\u缓存。以下是我的最低配置: upstream %(proj_name)s { server 127.0.0.1:%(gunicorn_port)s; } proxy_cache_path /cache keys_zone=bravo:10m; server { listen 80; listen 443;
upstream %(proj_name)s {
server 127.0.0.1:%(gunicorn_port)s;
}
proxy_cache_path /cache keys_zone=bravo:10m;
server {
listen 80;
listen 443;
server_name %(live_host)s;
client_max_body_size 100M;
keepalive_timeout 15;
location /static/ {
expires 1M;
access_log off;
add_header Cache-Control "public";
root %(proj_path)s;
}
location / {
expires 1M;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache bravo;
proxy_ignore_headers Cache-Control Expires Set-Cookie;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://%(proj_name)s;
}
}
样本响应:
HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 07 Jan 2015 03:43:47 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Vary: Cookie, Accept-Language
Content-Language: en
Expires: Fri, 06 Feb 2015 03:43:47 GMT
Cache-Control: max-age=2592000
X-Proxy-Cache: MISS
Content-Encoding: gzip
我启用了夹层缓存中间件,它将返回带有设置Cookie头的响应,但proxy\u ignore\u头应该忽略这一点
我在proxy\u cache\u path dir(/cache)上执行了chmod 777,所以这不应该是权限问题
错误日志记录已启用,但未生成任何内容
代理缓存路径
继续保持完全空
为什么nginx不使用此配置缓存任何内容?