Add to /etc/nginx/nginx.conf to http section
log_format cache '$remote_addr - [$time_local] "$host$request_uri" $status $upstream_cache_status';
fastcgi_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=dynamic:100m inactive=5m;
fastcgi_cache_key "$scheme://$host$request_uri";
Add to your virtualhost to location section
fastcgi_pass_header "X-Accel-Redirect";
fastcgi_pass_header "X-Accel-Expires";
fastcgi_cache dynamic;
fastcgi_cache_key $scheme$host$request_uri$request_method;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_cache_valid 200 301 302 10m;
access_log /var/log/nginx/access-cache.log cache;
then reload nginx
nginx -t && nginx -s reload
Thats all
log_format cache '$remote_addr - [$time_local] "$host$request_uri" $status $upstream_cache_status';
fastcgi_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=dynamic:100m inactive=5m;
fastcgi_cache_key "$scheme://$host$request_uri";
fastcgi_pass_header "X-Accel-Redirect";
fastcgi_pass_header "X-Accel-Expires";
fastcgi_cache dynamic;
fastcgi_cache_key $scheme$host$request_uri$request_method;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_cache_valid 200 301 302 10m;
access_log /var/log/nginx/access-cache.log cache;
then reload nginx
nginx -t && nginx -s reload
Thats all
No comments:
Post a Comment