Score:0

PHP-FPM - nginx - clear cache in different environments

cn flag

We have an environment with a web server running nginx, this has 4 virtual hosts (2 of them are the ones running in production, and the others 2 are for testing). We run php-fpm and all that nginx cache thing. Now, i have two questions:

  • How do i manage to only have the cache running for production and no for testing virtual hosts?
  • And, every time a new thing is incorporated to production, devs have to wait to cache to clear itself, which last 1 hour (devs don't have credentials to access the web server, they managed everything through a NFS). Is there a way to clear cache when they need to?

Thank you!

Score:0
cz flag

You can have no cache in your testing virtual hosts by simply not specifying one. For example don't put in any fastcgi_cache sort of directives.

And you can clear nginx's cache by just deleting the files from disk. You should be able to find some way to work this into your deployment process.

0diseus avatar
cn flag
In this case i have the fastcgi_cache_path directly in the nginx.conf file, i assume this is a general way to implement cache for all virtual hosts, am i right?
Michael Hampton avatar
cz flag
@EmmaSosa Yes, but in your case you should set up caches only in the `server` blocks in which you actually want them.
0diseus avatar
cn flag
And The problem erasing the cache is that it's stored in a separated web server in which devs don't have credentials to enter and clear cache in a traditional way. They manage everything throught a NFS machine. And also the IP of these machines changes a lot because they're in a autoscaling group.
us flag
You need to have an automated deploy process that does other things related to deployment than actual copying of code.
mangohost

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.