XenForo Forum with Nginx fastcgi_cache full page guest caching

XenForo Forum with Nginx fastcgi_cache full page guest caching

Add: fastcgi_cache_lock on;
Restricts the number of concurrent attempts to populate the cache, so that when a cached entry is being created, further requests for that resource are queued up in NGINX.
Likes: Mouth
For ngx_pagespeed users, add to your config "pagespeed ModifyCachingHeaders off;".
Likes: Sunka
fastcgi_cache_path /var/run/nginx_fastcgi_cache levels=1:2 keys_zone=fastcgicache:200m inactive=30m;
Added:
Code:
#add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
For HTTP Strict Transport Security (HSTS).
More info why it's needed to be added again: https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/
Likes: Sunka
Added filter for forums having multiple style.
Code:
~xf_style_id              1;
But commented out by default.

Mobile/Desktop View support commented out by default.
Code:
#map $http_user_agent $mobile_request {
#    default                                         0;
#    ~*android|ip(hone|od)|windows\s+(?:ce|phone)    1;
#    ~*symbian|sonyericsson|samsung|lg|blackberry    1;
#    ~*mobile                                        1;
#}
Code:
#fastcgi_cache_key       $scheme$request_method$host$request_uri$mobile_request;
Likes: Amin Sabet
Move several config under location context from http context.
fastcgi_cache_key $scheme$request_method$host$request_uri$mobile_request;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
To be sure only specific sites/location has caching enabled.
Likes: Amin Sabet
map $http_user_agent $mobile_request {
default 0;
~*android|ip(hone|od)|windows\s+(?:ce|phone) 1;
~*symbian|sonyericsson|samsung|lg|blackberry 1;
~*mobile 1;
}

fastcgi_cache_key $scheme$request_method$host$request_uri$mobile_request;
Likes: Amin Sabet
Added:
Code:
~^/logout               1;
Likes: Amin Sabet
Added more filter:
Code:
map $request_method $nocachemethod {
       default  0;
       POST     1;
}
Code:
fastcgi_cache_bypass    $nocachecookie $nocachemethod $nocacheuri;
fastcgi_no_cache        $nocachecookie $nocachemethod $nocacheuri;
@Amin Sabet :)
Likes: Amin Sabet
Top