mirror of
https://github.com/joglomedia/LEMPer.git
synced 2026-04-13 08:28:21 +00:00
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
## Include this file if you want to use fastcgi_cache across many sites
|
|
# Designed to be included in /etc/nginx/nginx.conf http {} block
|
|
|
|
fastcgi_cache_path /var/cache/nginx/fastcgi_cache levels=1:2 keys_zone=FASTCGICACHE:100m max_size=1g inactive=60m;
|
|
fastcgi_cache_key "$scheme$request_method$host$request_uri";
|
|
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
|
|
#fastcgi_cache_lock on;
|
|
|
|
# Ignore header
|
|
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
|
|
|
|
# Designed to be used with Nginx Cache Controller WP plugin
|
|
#fastcgi_pass_header "X-Accel-Redirect";
|
|
#fastcgi_pass_header "X-Accel-Expires";
|
|
|
|
# Header status
|
|
add_header X-Cache-Status $upstream_cache_status;
|
|
|
|
# FastCGI Log Format
|
|
log_format cache '$remote_addr - $upstream_cache_status [$time_local] '
|
|
'"$request" $status $body_bytes_sent '
|
|
'"$http_referer" "$http_user_agent"';
|
|
|
|
# Map Mobile
|
|
map $http_user_agent $is_mobile {
|
|
default 0;
|
|
~*android|ip(hone|ad|od)|windows\s+(?:ce|phone) 1;
|
|
~*symbian|sony|samsung|lg|blackberry 1;
|
|
~*mobile|mini 1;
|
|
}
|
|
|
|
# Map Cache
|
|
map $request_method $skip_cache {
|
|
default 0;
|
|
POST 1; #skip caching on post
|
|
}
|
|
|
|
map $http_cookie $skip_cache {
|
|
default 0;
|
|
~SESS 1; #skip PHP Session cookie
|
|
}
|