# Basic spammer protection w/ nginx?

**URL:** <https://www.ruby-forum.com/t/basic-spammer-protection-w-nginx/144684>\
**Category:** Deployment\
**Created:** [August 1, 2008, 6:07am UTC](https://www.ruby-forum.com/t/basic-spammer-protection-w-nginx/144684 "2008-08-01T06:07:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vince](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/b5e925/32.png) [@vince](https://www.ruby-forum.com/u/vince)\
**Post date:** [August 1, 2008, 6:07am UTC](https://www.ruby-forum.com/t/basic-spammer-protection-w-nginx/144684/1 "2008-08-01T06:07:27Z")

</div>

Does anyone have any recommendations for some basic rules I can apply  
to my nginx.conf file to prevent spambots and the like? I saw a post  
with some Apache/PHP specific stuff but I’m not sure how to convert it  
for Nginx/Rails:

RewriteEngine On  
RewriteCond %{REQUEST\_METHOD} POST  
RewriteCond %{REQUEST\_URI} .wp-comments-post.php\*  
RewriteCond %{HTTP\_REFERER} !._[yourdomain.com](http://yourdomain.com)._ [OR]  
RewriteCond %{HTTP\_USER\_AGENT} ^$  
RewriteRule (.\*) ^http://%{REMOTE\_ADDR}/$ [R=301,L]

It seems a spammer is scraping the authenticity token from my site so  
I need to find another way…

Thanks in advance,  
Vince
