rtCamp / nginx-helper

Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
https://wordpress.org/plugins/nginx-helper/
224 stars 117 forks source link

Delete local server cache files not working with separate upstream php-fpm server #290

Closed kirkre closed 1 year ago

kirkre commented 1 year ago

First I test purging by making a change to the page being tested, as the nginx-helper logs are more detailed for this than for purge all.

From nginx-helper log: 2022-12-17 06:56:17 | INFO | - - http://192.168.72.83/bookings/ is currently not cached ( checked for file: /var/run/nginx-cache/e/80/34a12505958bb9ecadcd4bec754aa80e )

After this I check the path above:

ls -al /var/run/nginx-cache/e/80/34a12505958bb9ecadcd4bec754aa80e

-rw------- 1 nginx nginx 161734 Dec 17 06:16 /var/run/nginx-cache/e/80/34a12505958bb9ecadcd4bec754aa80e

Purge does not work.

NGINX and PHP-FPM are running as the same user. PHP-FPM is running in a separate upstream server. Both the nginx-helper GET request method and delete local server cache methods work with nginx and php-fpm running on the same server and everything else the same, but shouldn't the delete local server cache files method at least work with an upstream php-fpm server?

Thanks,

Kirk

gagan0123 commented 1 year ago

@kirkre

It does not matter whether NGINX and PHP-FPM are running on the same server or not, as long as you've configured the NGINX config correctly and have selected the Purge Method as "Using GET request", which is the default option

image

Here's some reference on how you can correctly configure NGINX to handle the purge requests which are sent by the plugin: https://easyengine.io/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/

Closing the issue, as I couldn't replicate the issue even with the multi tier architecture as mentioned.