nginx-helper icon indicating copy to clipboard operation
nginx-helper copied to clipboard

Conflict Fastcgi cache folder permissions with Nginx

Open glen777 opened this issue 2 years ago • 1 comments

I do not have the ngx_cache_purge module, because it apparently would require uninstalling nginx and reinstalling, thus requiring my sys admin to re-do a lot of work we’ve done on that server. (and doesn’t that module require a nginx paid subscription ?)

So we chose the purge method of: ‘Delete local server cache files. Checks for matching cache file in RT_WP_NGINX_HELPER_CACHE_PATH.’ We set the path as /home/site-owner-user/nginx-cache/cache

Due to the virtualmin PHP setup, it created it's own PHP pool for the virtual server and therefore ran PHP under the site-owner-user. But NGINX uses the cache folder as user 'www-data', however this directory was not writable by other users. Therefore when wordpress tried to clear the cache, the folder could not be deleted and recreated.

I could fix this by manually changing the folder permissions, but when wordpress recreated the cache folder it would now be owned by the user 'classicwp' and NGINX could no longer write cache files to that location. When we tried to do a shared ‘group’ for them, nginx just ignored that. NGINX doesn't allow us to specify the file permissions for the cache files it creates. They're stuck at a level that does not allow the group to write.

We CAN make it work when we change the PHP user to www-data (same as nginx), but this raises security problems if 20 wordpress clients all run as that same nginx user, www-data.
So, what is the solution?
Thanks so much for any ideas

glen777 avatar Jul 10 '21 05:07 glen777

The module in question is https://github.com/FRiCKLE/ngx_cache_purge

jordantrizz avatar Apr 05 '22 13:04 jordantrizz