tengine mysql_tengine 缓存 配置,-1:


ngx_http_cache_purge_module

–add-module=/apps/svr/ngx_cache_purge-2.3

控制nginx缓存过期时间

location ~ ^/(p_w_picpaths|javascript|js|css|flash|media|static)/ {

expires 5m;

}

max:指定“Expires”的值为31 December2037 23:59:59GMT,"Cache-Control"的值为10年。

-1:指定“Expires”的值为当前服务器时间-1s,即永远过期。

off:不修改“Expires”和"Cache-Control"的值

必须在前端指定

./configure --prefix=/usr/local/tengine --conf-path=/usr/local/tengine/conf/nginx.conf --pid-path=/var/log/tengine/tengine.pid --error-log-path=/var/log/tengine/error.log --without-http_memcached_module --user=nginx --group=nginx --with-poll_module --with-syslog --with-http_p_w_picpath_filter_module --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/opt/src/openssl-1.0.2 --with-openssl-opt=-fPIC --with-zlib=/opt/src/zlib-1.2.8 --with-pcre=/opt/src/pcre-8.35 --with-http_stub_status_module --with-http_sub_module --add-module=/opt/src/nginx-accesskey-2.0.3 --add-module=/opt/src/ngx-fancyindex/ --with-http_realip_module --with-http_sysguard_module --with-http_trim_filter_module=shared --with-http_rewrite_module=shared --with-http_access_module=shared --with-google_perftools_module --with-http_limit_conn_module=shared --with-http_limit_req_module=shared --with-http_upstream_ip_hash_module=shared --with-http_upstream_least_conn_module=shared --with-http_upstream_session_sticky_module=shared --with-google_perftools_module --with-http_upstream_check_module --with-http_concat_module=shared --add-module=/opt/src/nginx_tcp_proxy_module  --add-module=/opt/src/ngx_cache_purge-2.2

killall nginx

cp ./objs/nginx /home/data/websrv/nginx/sbin/

配置

location ~ /purge(/.*) {

allow 127.0.0.1;

allow 192.168.1.0/24;

deny all;

proxy_cache_purge cache_one $host$1$is_args$args;

}

location ~ .*\.(htm|html|js|css|gif|jpg|jpeg|png|bmp|ico|swf|flv)$ {

proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header;

proxy_cache cache_one;

proxy_cache_valid 200 304 15m;

proxy_cache_valid 301 302 10m;

proxy_cache_valid any 1m;

proxy_cache_key $host$uri$is_args$args;

add_header Ten-webcache '$upstream_cache_status from $host';

proxy_pass http://NORTH1_SERVER_PROXY;

expires 30m

}

相关内容