Question

FastCGI always MISS when Wordfence is enabled.

Hello, yesterday i installed wordfence and then eanbled Nginx FastCGI. but FastCGI isnt working. all pages are maked as MISS.

then i disabled wordfence and everything is fine again. i contacted with wordfence auther but till now no answer.

is there anyone using Nginx FastCGI and wordfence together??

my FastCGI setup is pretty basic.

fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
#fastcgi_cache start
set $no_cache 0;

# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
        set $no_cache 1;
}   
if ($query_string != "") {
        set $no_cache 1;
}   

# Don't cache uris containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
        set $no_cache 1;
}   

# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
        set $no_cache 1;
} 

 location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_cache WORDPRESS;
                fastcgi_cache_valid 200 60m;
                fastcgi_cache_bypass $no_cache;
                fastcgi_no_cache $no_cache;
}
Subscribe
Share

Update to my first post regarding FastCGI & Wordfence

i was testing since this afternoon to find out the cause. what i realized, pages thats been cached before enabling wordfence is HIT but pages which are not cached by FastCGI before enabling wordfence is MISS always.

it seems, after enabling wordfence, nginx cant create any new file inside /var/run/nginx-cache folder which it can serve later on.

whats the reason for this behavior can be?

@jtittle & @hansen also im always getting this in my nginx error.log when browsing my sub-domain which is installed in multisite level.

2017/05/18 18:49:04 [error] 8293#8293: *1 FastCGI sent in stderr: "PHP message: Aq_Resize.process() error: $url parameter is required
PHP message: Aq_Resize.process() error: $url parameter is required" while reading upstream, client: 103.205.453.223, server: mysite.com, request: "GET /tutorials/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "community.mysite.com", referrer: "https://community.mysite.com/forum/"
2017/05/18 18:49:04 [error] 8293#8293: *1 FastCGI sent in stderr: "PHP message: Aq_Resize.process() error: $url parameter is required
PHP message: Aq_Resize.process() error: $url parameter is required
PHP message: Aq_Resize.process() error: $url parameter is required
PHP message: Aq_Resize.process() error: $url parameter is required" while reading upstream, client: 103.205.453.223, server: mysite.com, request: "GET /tutorials/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "community.mysite.com", referrer: "https://community.mysite.com/forum/"

do u have any idea what is this error massage about??

thanks in advance.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@newbie

FastCGI Caching does full-page caching, which means changes to output won’t take until the cache is flushed for the requested URI, or entirely (in some cases). Unfortunately, the plugin that used to work with NGINX to aid in flushing the cache has not been updated in a while which makes this a manual process.

Some plugins may work with FastCGI Cache, others may not – there’s really no guarantee as to what will and won’t work unfortunately.

I’ve never ran in to issues with FastCGI (without caching) and WordFence – though I rarely use FastCGI Caching unless there’s a viable solution readily available for flushing the cache and it’s tested across the platform to ensure that it works entirely. As of right now, it’s a manual process, or a custom solution needs to be implemented to perform the flushing.

Enabling FastCGI caching, as you’re experiencing, can have some odd and unintended results from time to time, which is why you really need to test it 100% in development before using it in production.