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;
}
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.
×
@jtittle & @hansen
also im always getting this in my nginx error.log when browsing my sub-domain which is installed in multisite level.
do u have any idea what is this error massage about??
thanks in advance.
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?