[Wordpress][CACHE] Fastcgi_cache or proxy_cache?

ml flag

I'm preparing a server to host a classic WordPress site (lots of dynamic content).

I have an apache server associated with a Nginx reverse proxy ( with the proxy_pass configuration ). I have several ideas to advance my NGINX configuration: A) distribute the static part via the reverse proxy without going through a cache system. B) Cache with Fastcgi_cache with many filters to exclude dynamic content. C) Cache with proxy_cache with many filters to exclude dynamic content.

What is the most logical solution?

us flag

If Apache2 and nginx both can access the same filesystem, then it is more efficient that nginx directly serves all static assets. That is how I have configured a similar setup. Therefore option A should be always applied.

If you want to replace Apache2 with PHP-FPM, then you can use option B to cache output from PHP scripts.

With your current setup, you can use option C to cache PHP script output.

I would estimate that biggest gains in performance would happen with caching PHP script content. The more you can cache as static files, the more CPU you save and the faster the site is.

You should also consider adding cache flushing from WordPress side, so that cache gets flushed whenever content is updated. However, without closer knowledge on the nature of your dynamic content, I don't know how effective this would be.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.