How to use ncache- delete the old ncache files and folders
./configure
make
make installedit your config file at
{install_prefix}/conf/ncache.conf run the "mkdir_ngx_cache.sh" to make cache dir:
{install_prefix}/bin/mkdir_ngx_cache.sh {install_prefix}/conf/ncache.conf - example to make cache directories :
/usr/local/ncache/bin/mkdir_ngx_cache.sh /usr/local/ncache/conf/ncache.conf note:only support linux
- example to config the ncache
user www www;
worker_processes 4;
#ulimit -n 20480
worker_rlimit_nofile 20480;
events
{
worker_connections 10240;
}
http
{
sendfile on;
keepalive_timeout 65;
#here to set the free list max size 2 Power 24 about 30,000,000
#in 1.2 or 1.1 it is 25
cache_max_size 24;
#the new config in v1.3 to set proxy big file buffer null
proxy_buffering off;
upstream backend
{
server 10.1.1.1;
server 10.1.1.2;
#just support 256,128,and 64
#you must end path with '/'
cachedir /data0/ 128 128;
cachedir /data1/ 64 64;
}
server
{
listen 80;
set $purge_uri $request_uri;
location /
{
if ($request_method ~ "PURGE")
{
rewrite (.*) /PURGE$1 last;
}
proxy_pass http://backend;
#here you can ignore any client use "Cache-Control:no-cache" headers refresh the cache
proxy_ignore_client_no_cache on;
}
#allow some one who can use http PURGE method delete the caches
location /PURGE/
{
internal;
allow 10.1.1.0/24;
deny all;
purge;
}
#use "http://{serverip}/status_infos" watch nginx services status
location /status_infos
{
access_log off;
stub_status on;
}
}
}
you must add the http header Cache-Control: max-age=*** to the backend server which you want to be cached, ortherwise, ncache will not cache it forever.
if you set max-age < 1 minute ncache will set it to 1 minute, and ncache will exact all max-age to minute, so please align it to 60.
run: {install_prefix}/sbin/ncache
kill: kill -9 ps auwx|grep ncache|awk '{print $2}'
|
如何设计虚拟主机啊? 好像这一段 " server 10.1.1.1; server 10.1.1.2;" 但我弄了,没有用啊,说我找不到此页
能不能实现http://wwwtest.zdnet.com.cn/techupdate/2007/0831/481941.shtml中的功能?给个置。
能不能实现 http://wwwtest.zdnet.com.cn/techupdate/2007/0831/481941.shtml 中的功能?给个一个配置实例!
能不能实现 http://wwwtest.zdnet.com.cn/techupdate/2007/0831/481941.shtml 中后台多个WEB服务的功能?给个一个配置实例!
If you fail to have a user and group in the ncache.conf file mkdir_ngx_cache.sh will fail to chown properly.
配置多个Web应用的时候就不行了。
无法命中啊 time_count:603 request_count:335569 shoot_count:0 disk_writes:0 store_files:0 upstream_count:49 free_index:16777215