The old topic is related to nginx web server.
Is your issue also on nginx web server ?
To prevent any confusion, I’m not iThemes.
Hi @nlpro , thanks for replying, even if you’re not part of iTheme !
Indeed, the issue is also on nginx web server.
Ok, you could try and reset permalinks.
As far as I can see there is nothing wrong with the rules added to the (plugin) nginx.conf file. Those rules don’t even return code 405, only 403…
I’ve actually found some info on the internet suggesting the issue is caused by the line below in the iTSec plugin nginx.conf file:
limit_except POST { deny all; }
Unfortunately my nginx Test env is currently not available due to a hardware failure. So I can’t say anything for sure.
Please try and temporarily remove the line mentioned above from the iTSec plugin nginx.conf file and see whether that makes any difference.
Thanks a lot for having made researches !
It doesn’t come from permalink cause I reset them and it doesn’t work better.
About the nginx.conf, I checked for the line you told me about but couldn’t find any “limit_except” line…
-
This reply was modified 5 years, 11 months ago by
arbremojo.
Ok, resetting the permalinks was worth a try.
The complete lines added by the Reduce Comment Spam setting to the iTSec plugin nginx.conf file look like this:
# Reduce Comment Spam – Security > Settings > WordPress Tweaks > Comment Spam
location = /wp-comments-post.php {
limit_except POST { deny all; }
if ($http_user_agent ~ “^$”) { return 403; }
valid_referers server_names jetpack.wordpress.com/jetpack-comment/;
if ($invalid_referer) { return 403; }
}
Oh, (to identify the correct nginx.conf file) log into the WordPress Dashboard and navigate to the Security/Settings page then click on the Configure Settings button of the Global Settings module. Scroll down till you see the “NGINX Conf File” setting.
-
This reply was modified 5 years, 11 months ago by
nlpro.
Sorry, I just didn’t enable the Reduce Comment Spam functionality, that’s why those lines were not added to the nginx.conf file ^^’
So, I’ve been able to see this line that I temporarily commented, and there’s still the error 405…
Hmm, ok. Lets get to the bottom of this. Change the lines in the nginx.conf like this:
# Reduce Comment Spam – Security > Settings > WordPress Tweaks > Comment Spam
location = /wp-comments-post.php {
# limit_except POST { deny all; }
# if ($http_user_agent ~ “^$”) { return 403; }
# valid_referers server_names jetpack.wordpress.com/jetpack-comment/;
# if ($invalid_referer) { return 403; }
}
Very interested to hear the result.
Do note I’m assuming any change to the (plugin) nginx.conf file is automatically picked up by your nginx web server. Which normally requires the nginx config to be (auto) reloaded or the nginx Web server restarted.
I commented those lines, and still an error 405… I tried without restarted the nginx server and by having restarted it, still the same result.
Ok, that was helpfull.
If I understand correctly Nginx can’t serve static content (Like .html files) on a POST request.
It seems the line:
location = /wp-comments-post.php { }
is causing nginx to think it must serve static content on a POST (or GET) request of wp-comments-post.php
So for some reason adding the location line makes nginx think the wp-comments-post.php is a static file. But it’s not, it’s a php script file.
This must be an nginx configuration issue. Probably the iTSec plugin specific nginx.conf is not included in the right position within the main nginx.conf file.
Thanks a lot @nlpro ! It was very kind of you to look into it, even though you’re not part of iTSec plugin support 🙂
So now, I’m calling for a iTheme Security support please!
Thank you. You are welcome.
Anyone helping you will need the complete nginx configuration of your env. Note I have determined that the issue as described in this topic is probably not due to an issue in the iTSec plugin. It seems to me the plugin nginx.conf file is not properly included into your main nginx server configuration file. Therefor this is more of a generic nginx configuration issue.
I would recommend to read this excellent post about Understanding Nginx Server and Location Block Selection Algorithms. It may assist you in solving your issue.