How to enable fastcgi cache for WordPress with aapanel
- Edited
aaPanel_Jose
When I copy the config file from here to my server , I got this error :
I add my ip address in allow "change_to_your_server_ip";
and in /www/server/panel/vhost/nginx/mysite.com.conf:68
second question : I'm running php 8 , is need to change 73 to 8 ?
in this line :
fastcgi_pass unix:/tmp/php-cgi-73.sock;
aaP_raha_ab1988 Post the screenshot of line 99 of the website configuration file you reported wrong
Modify to the php version you are running
aaPanel_Captain
Nginx conf
Site configutation
- Edited
aaP_raha_ab1988 second question : I'm running php 8 , is need to change 73 to 8 ?
fastcgi_pass unix:/tmp/php-cgi-80.sock;
Now the config saved whiteout error but in testing with browser, I couldn't find any FastCGI cache
- Edited
aaP_raha_ab1988 Cache does not work for logged in users. Check in private browsing mode.
aapanel_user Yes you right , I cheek that and then works perfect ,
Now for wordpress which plugin? WP-Rocket or WP-fastest cache?
aaP_raha_ab1988 I didn't use any of them. And if you use fastcgi cache you don't really need cache plugins.
aapanel_user Dos that minifiy java script and css and html ?
aaP_raha_ab1988 For wordpress with fastcgi cache i recommend autoptimize work well together.
aaP_raha_ab1988 No. I also recommend autoptimize.
I am trying to setup my second site for fastcgi-cache
So I can just use the same directory ?
mkdir /dev/shm/fastcgi-cache
or I need to create new directory for new site ?
mkdir /dev/shm/fastcgi-cache2
and new config site
define('RT_WP_NGINX_HELPER_CACHE_PATH', '/dev/shm/fastcgi-cache2');
????
lucius100 Caching on local disk is not as fast as putting it in an in-memory database like Redis|MongoDB|Memcached. You can try using
aapanel_power
With all due respect, that is not what @lucius100 is asking. I also would like to know the answer to his question.
Besides that, I don't believe that Redis should be used for full page caching, but Fastcgi.
Kind greetings,
Jimmy
JimmyBobsa I think we can mix the folder for both site, but purge cache sure will clear the cache for 2 sites, that's why we need to create second folder maybe ?
@aapanel_power I just want to use fastcgi on local disk, no enough memory for redis,etc.
lucius100 but purge cache sure will clear the cache for 2 sites
Correct. I have 11 WP sites running on a 4GB VPS and all sites are really fast. But when 1 sites clears the cache, cache is purched for all sites. So 1 dir per website is the best idea indeed. Could not find how to make it work like that.
JimmyBobsa Try make change to directory in step 1,2,6
/dev/shm/fastcgi-cache
make it more memorable, if website is example.com try use folder
/dev/shm/example
In theory, it should work.
lucius100 In theory, it should work.
Yep, but it doesn't
I have tried different way's, but the cache dir stay's empty. I tried with PHP 7.3/7.4 and 8
- Edited
JimmyBobsa I tried it just now, and it doesn't work lol.
ERROR:
nginx: [emerg] "fastcgi_cache_key" directive is duplicate in /www/server/panel/vhost/nginx/example.com.conf:1
nginx: configuration file /www/server/nginx/conf/nginx.conf test failed
I can't even use same setting for second site, it seems like fastcgi caching only can for 1 website.
So right now, all your website no caching ?
I just migrated from OLS to nginx, there's no way I gonna back again T_T
Really hope there's solution for fastcgi caching 2 or more website