server
{
listen 80;
server_name bbs.xxxx.com;
index index.php index.html index.htm;
root /www/xxxx_com/xxxx/bbs;
#limit_conn crawler 20;
location ~ ^/data/.*\.(php|php5)$
{
deny all;
}
location ~ ^/images/.*\.(php|php5)$
{
deny all;
}
location ~ ^/attachment/.*\.(php|php5)$
{
deny all;
}
location ~ ^/htm_data/.*\.(php|php5)$
{
deny all;
}
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|js|css)$ {
valid_referers none blocked *.xxxx.com xxxx.com *.qihoo.com qihoo.com baidu.com *.baidu.com *.google.com *.google.cn google.cn google.com;
if ($invalid_referer) {
rewrite ^/ http://www.xxxx.com/error.gif;
#return 403;
}
access_log off;
expires 30d;
break;
}
location / {
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
}
#access_log /dev/null;
#error_log /dev/null;
log_format wdtxtaccess '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for $request_time';
access_log /usr/local/nginx/logs/wdtxtaccess.log wdtxtaccess;
}
注意 你配置的是 bbs.xxxx.com
if ($invalid_referer) {
rewrite ^/ http://www.xxxx.com/error.gif;
#return 403;
}
这一段的http://www.xxxx.com/error.gif千万不能使用http://bbs.xxxx.com/error.gif
不然死循环了