How to clear your proxy's cache, without fastcgi_cache_purge

Didn’t know that module was free, the paid NGINX has something that does that. Use NGINX Helper, and set it to URL, then use fcgiwrap. Change the user and group it runs as to whatever nginx is, it’s a cache, so there’s nothing to hack. If using Debian, edit the fcgiwrap.service file. You might need to edit /etc/init.d/fcgiwrap too.
Clicking Purge Cache won’t work with the NGINX Helper plugin. Posting will clear the cache. There’s nothing in my logs about it accessing the URL when clicking purge. I think purge isn’t using a GET request, it’s trying to delete the contents of the cache folder, I deleted it on the non proxy/cache and the errors went away. Was getting permission denied. You’d have to edit it, to tell it to use GET for the Purge Cache option.
Add the below to your /etc/nginx/sites-enabled/default:

        location ~ /purge(/.*) {
		 gzip off;
	         fastcgi_pass unix:/var/run/fcgiwrap.socket;
    		 include /etc/nginx/fastcgi_params;
    		 fastcgi_param DOCUMENT_ROOT /var/www/html;
    		 fastcgi_param SCRIPT_FILENAME /var/www/html/cache.sh;
        }

And the /var/www/html/cache.sh file:

#!/bin/sh
echo "HTTP/1.0 200 OK\r\n"
rm -fr /var/www/nginx_cache/*

Probably better to use the fastcgi_cache_purge module. Instructions for that module here.
It will be slow when posting if you do that too.
You might want to add “deny all;” and “allow ip;” to the NGINX config file. For the purge location. Just allow whatever the main VPS’s IP is, the backend. If it’s all running on the same server, then use 127.0.0.1.
If you edit the plugin, and make it only access one URL, clearing might be faster. I assume it’s accessing a bunch of purge URLs, which is pointless with that shell script. All the URLS do the same thing.