I got it working 99% as far as I tested
Big credits to @hungphutho and @eva2000 of centminmod community
My config:
nginx.conf
For others, should be above server{ block.
For centminmod users: above include /usr/local/nginx/conf/conf.d/*.conf;
php.conf above }
Domain.conf above location / {
Big credits to @hungphutho and @eva2000 of centminmod community
My config:
nginx.conf
For others, should be above server{ block.
For centminmod users: above include /usr/local/nginx/conf/conf.d/*.conf;
Code:
### fastcgi_cache
###
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=phcornercache:500m inactive=1d max_size=2g;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_lock on;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
###
### fastcgi_cache end
php.conf above }
Code:
### fastcgi_cache
###
fastcgi_cache phcornercache;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
fastcgi_cache_valid 200 302 15m;
fastcgi_cache_valid 301 1d;
fastcgi_cache_valid 404 5m;
fastcgi_cache_valid any 15m;
add_header X-Cached $upstream_cache_status;
###
### fastcgi_cache end
Domain.conf above location / {
Code:
### fastCgi cache
set $no_cache 0;
# POST requests should always go to PHP
if ($request_method = POST) {
set $no_cache 1;
}
# Don't use the cache for logged in users
if ($http_cookie ~* "xf_session_admin|xf_user|xf_user_admin") {
set $no_cache 1;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "(admin.php|/account/|/conversations/|/misc/|/online/|/login/|/register/|/login|/register|/library/|/internal_data/)") {
set $no_cache 1;
}
### fastCgi end
Last edited: