我们的栈是运行在EC2实例上的Nginx – gunicorn – 夹层(django cms)。 一切正常,但我似乎无法启用Nginx的proxy_cache。 这是我最小的configuration:
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
我启用了夹层caching中间件,它使用Set-Cookie头返回响应,但proxy_ignore_headers应该忽略它。
我在proxy_cache_path dir(/ cache)上执行了chmod 777,所以它不应该是一个权限问题。
现场启动夹层网站
django-filebrowser(mezzanine)无法在Nginx生产服务器上加载大型Amazon S3目录
错误logging被启用,但什么也没有产生。
proxy_cache_path继续保持完全空白…
为什么Nginx不用这个configurationcaching任何东西?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。