ngx_cache_viewer
404 次浏览
更新于 2020-10-31 14:39

授权协议:Apache License 2.0
原作者联系方式:agile6v@gmail.com
功能说明:nginx cache可视化插件
  • 内容介绍

About

nginx module which adds ability to view cache node info from FastCGI, proxy, SCGI and uWSGI caches. It inspired by ngx_cache_purge module.

Configuration directives (same location syntax)

fastcgi_cache_viewer

  • syntaxfastcgi_cache_viewer on|off|<method> [from all|<ip> [.. <ip>]]
  • defaultnone
  • contexthttpserverlocation

Allow viewing of selected pages from FastCGI's cache.

proxy_cache_viewer

  • syntaxproxy_cache_viewer on|off|<method> [from all|<ip> [.. <ip>]]
  • defaultnone
  • contexthttpserverlocation

Allow viewing of selected pages from proxy's cache.

scgi_cache_viewer

  • syntaxscgi_cache_viewer on|off|<method> [from all|<ip> [.. <ip>]]
  • defaultnone
  • contexthttpserverlocation

Allow viewing of selected pages from SCGI's cache.

uwsgi_cache_viewer

  • syntaxuwsgi_cache_viewer on|off|<method> [from all|<ip> [.. <ip>]]
  • defaultnone
  • contexthttpserverlocation

Allow viewing of selected pages from uWSGI's cache.

Configuration directives (separate location syntax)

fastcgi_cache_viewer

  • syntaxfastcgi_cache_viewer zone_name key
  • defaultnone
  • contextlocation

Sets area and key used for viewing selected pages from FastCGI's cache.

proxy_cache_viewer

  • syntaxproxy_cache_viewer zone_name key
  • defaultnone
  • contextlocation

Sets area and key used for viewing selected pages from proxy's cache.

scgi_cache_viewer

  • syntaxscgi_cache_viewer zone_name key
  • defaultnone
  • contextlocation

Sets area and key used for viewing selected pages from SCGI's cache.

uwsgi_cache_viewer

  • syntaxuwsgi_cache_viewer zone_name key
  • defaultnone
  • contextlocation

Sets area and key used for viewing selected pages from uWSGI's cache.

Sample configuration (same location syntax)

http {
    proxy_cache_path  /tmp/cache  keys_zone=tmpcache:10m max_size=1g;

    server {
        location / {
            proxy_pass         http://127.0.0.1:8000;
            proxy_cache        tmpcache;
            proxy_cache_key    $uri$is_args$args;
            proxy_cache_viewer VIEWER from 127.0.0.1;
        }
    }
}

Sample configuration (separate location syntax)

http {
    proxy_cache_path  /tmp/cache  keys_zone=tmpcache:10m max_size=1g;

    server {
        location / {
            proxy_pass         http://127.0.0.1:8000;
            proxy_cache        tmpcache;
            proxy_cache_key    $uri$is_args$args;
        }

        location ~ /viewer(/.*) {
            allow              127.0.0.1;
            deny               all;
            proxy_cache_viewer tmpcache $1$is_args$args;
        }
    }
}

Sample Output

$ curl http://127.0.0.1:8000/003 -X VIEWER
################## share memory ##################
name:             tmpcache
mem size(Kb):     10240
cache node count: 3
cache path:       /tmp/cache
disk blocks:      262144
used disk blocks: 3
disk block size:  4096
inactive time(s): 600
-------------------------------------------
filename:         /tmp/cache/f16f9677cebace31cfe18821d4da093e
valid_sec:        0
count:            1
uses:             3
expire(UTC):      1385640959
body_start:       340
fs_size(block):   1
exists:           1
updating:         0
deleting:         0


$ curl http://127.0.0.1:8000/ -X VIEWER
################## share memory ##################
name:             tmpcache
mem size(Kb):     10240
cache node count: 3
cache path:       /tmp/cache
disk blocks:      262144
used disk blocks: 3
disk block size:  4096
inactive time(s): 600
-------------------------------------------

Declaration

This README template copy from ngx_cache_purge module and make a little modification.

See also

发表评论
提交者

皮皮鲁

暂无个人介绍

  • 27

    文章

  • 19

    关注

  • 26

    粉丝

Copyright 公安部网络安全保卫局 All Rights Reserved
京公网安备 11010502047880号    京ICP备05070602号