Nginx演练(4)配置内容缓存
http {include mime.types;
default_typeapplication/octet-stream;
log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_loglogs/access.logmain;
sendfile on;
#tcp_nopush on;
#keepalive_timeout0;
keepalive_timeout65;
proxy_cache_path /usr/local/nginx/proxy_cache levels=1:2 keys_zone=content:20m inactive=1d max_size=100m;
proxy_cache content;
server {
listen 80;
add_header X-Via $server_addr;
location /proxytest
{
proxy_cache content;
proxy_cache_valid200 304 301 302 10d;
proxy_cache_validany 1d;
proxy_cache_key $host$uri$is_args$args;
proxy_pass http://localhost:8000/;
}
}
server {
listen 8000;
access_log logs/server1.access.log main;
location /
{
index index.html index.htm;
add_header Cache-Control public;
#add_header Expires 0;
if_modified_since exact;
etag off;
root /u01/up1/bootstrap-3.3.5/docs;
}
}
etag off;
}
页:
[1]