Hello @coldrealms65,
I tested your approach with the following setup on my gentoo server:
My actual setup have PHP-FPM-USER (as a known WEBSITE-USER or PHP process owner) and WEBSERVER-USER (commonly, nginx or www-data)
Environment:
Web Server: NGINX, configured with FastCGI cache
Source Path: (Original NGINX Cache Path)
/dev/shm/fastcgi-cache-psauxit
FUSE Mount Point (with altered permissions for PHP process owner): This FUSE mount point will be used as the NGINX Cache Path in the NPP plugin settings instead of the original.
/dev/shm/fastcgi-cache-psauxit-mnt
PHP Process Owner: (Also known as the WEBSITE-USER or PHP-FPM-USER)
psauxit
WEBSERVER-USER:
nginx
To complete the setup:
1- Install bindfs via package manager: (vary on your linux distro)
emerge --ask sys-fs/bindfs
2- Create the new FUSE mount directory:
mkdir /dev/shm/fastcgi-cache-psauxit-mnt
3- Set up the bindfs mount with appropriate permissions:
bindfs -u psauxit -g psauxit --perms=u=rwx:g=rwx:o=rx /dev/shm/fastcgi-cache-psauxit /dev/shm/fastcgi-cache-psauxit-mnt
Alternatively make it persistent via /etc/fstab
:
bindfs#/dev/shm/fastcgi-cache-psauxit /dev/shm/fastcgi-cache-psauxit-mnt fuse force-user=psauxit,force-group=psauxit,perms=u=rwx:g=rwx:o=rx 0 0
4- Set /dev/shm/fastcgi-cache-psauxit-mnt
as a NGINX Cache Path in NPP plugin settings page and test Purge and Preload actions.
Your approach works exceptionally well and, in my tests, it’s more stable than the original inotifywait/setfacl
setup that I scripted it in bash for WP community. I was seeking a more reliable solution, as inotifywait/setfacl
sometimes struggles with responding consistently to rapid file creation events during cache preloading.
I will try to automate this approach with bash scripting as much as possible for easy NPP integration.
This is very valuable technical feedback. Thank you!
-
This reply was modified 3 weeks, 3 days ago by Hasan ?ALI?IR. Reason: fix mount path