• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
XenForo Forum with Nginx fastcgi_cache full page guest caching

XenForo Forum with Nginx fastcgi_cache full page guest caching

RoldanLT

Well-known member

Mouth

Well-known member
That's a long max-age, and I don't agree with subdomains. The latter particularly useless if using www. for your site url.
I think this is better;
Code:
#add_header Strict-Transport-Security "max-age=15638400; preload" always;
 

RoldanLT

Well-known member
@RoldanLT we should add that commented (#)?
Remove "#" if you want to enable, I just comment it out since not all are on https side and need it.

That's a long max-age, and I don't agree with subdomains. The latter particularly useless if using www. for your site url.
I think this is better;
Code:
#add_header Strict-Transport-Security "max-age=15638400; preload" always;
Yeah you can customize max-age to your preferred value, but doesn't matter anyway when you start using HTTPS now there's no reason on turning back.
 
Hi @RoldanLT
Thank you for your work,
I have 3 questions

Is it possible to set fastcgi to recache pages after 15min instead of just remove them from cache. Like this we will have 100% hit

Is it possible to have a different cache time for the index page?

Can you explain how to cache on ram for centminmod

Thank you
 

RoldanLT

Well-known member
Is it possible to set fastcgi to recache pages after 15min instead of just remove them from cache. Like this we will have 100% hit
I can only think of doing a cron to regularly visit/preload top pages like homepage or portal.
It's over and killing your server resources if you need to visit each thousand threads every 15 minutes.

Is it possible to have a different cache time for the index page?
Maybe, but haven't tried it yet.

Can you explain how to cache on ram for centminmod
It's already using that method now :).

Nice
Will it wirkes after server reboot?
New cache files will be generated.
 

Sunka

Well-known member
That was added before. I have that line in nginx.conf already.
I am confused now

Code:
### Start FastCGI Cache - RoldanLT ADDON ################
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;
}
map $http_cookie $nocachecookie {
     default                   0;
    ~xf_fbUid                  1;
    ~xf_user                   1;
    ~xf_logged_in              1;
}
map $request_uri $nocacheuri {
       default              0;
    ~^/register             1;
    ~^/login                1;
    ~^/validate-field       1;
    ~^/captcha              1;
    ~^/lost-password        1;
    ~^/two-step             1;
}
fastcgi_cache_path  /tmp/nginx_fastcgi_cache levels=1:2 keys_zone=fastcgicache:200m inactive=30m;
### End FastCGI Cache - RoldanLT ADDON ################
 

RoldanLT

Well-known member
I get a configtest failure when changing the fastcgi_cache_path.
I assume because the [...]/fascgi_nginx_cache/ path doesn't exist. But if I create it manually, then it won't persist across reboot and nginx will fail to run. Yes?
On my server the folder was created automatically.
Maybe on your setup Nginx don't have write permission on /var/run/, not sure why.

That was added before. I have that line in nginx.conf already.
I am confused now

Code:
### Start FastCGI Cache - RoldanLT ADDON ################
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;
}
map $http_cookie $nocachecookie {
     default                   0;
    ~xf_fbUid                  1;
    ~xf_user                   1;
    ~xf_logged_in              1;
}
map $request_uri $nocacheuri {
       default              0;
    ~^/register             1;
    ~^/login                1;
    ~^/validate-field       1;
    ~^/captcha              1;
    ~^/lost-password        1;
    ~^/two-step             1;
}
fastcgi_cache_path  /tmp/nginx_fastcgi_cache levels=1:2 keys_zone=fastcgicache:200m inactive=30m;
### End FastCGI Cache - RoldanLT ADDON ################
Just replace it with the new value.
Then try "nginx -t" first before doing Nginx restart.