server
{
listen 80;
server_name www.54rk.cn;
index index.html index.htm index.php;
root /data/wwwroot/xuexiji.ebandao.cn/webroot;
access_log /data/ httplogs/access_xuexiji.ebandao.cn.log combined;

error_page 404 /404error/404.html;
error_page 500 502 503 504 /404error/50x.html;
###########注意看下面了###########
location / {
#www rewrite
rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 last;
rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 last;
rewrite ^/tag-(.+)\.html$ /tag.php?name=$1 last;
break;
}

#Preventing hot linking of images and other file types
location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip)$ {
valid_referers none blocked server_names
*.ebandao.cn ;
if ($invalid_referer) {
rewrite ^/
![](error.gif)
;
#return 403;
}
}

#support php
location ~ .*\.php?$
{
include conf/fastcgi_params.conf;
fastcgi_pass 127.0.0.1:10080;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /data/wwwroot/www.ebandao.cn/webroot$fastcgi_script_name;
}
if (-d $request_filename){
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
}

}

rewrite伪静态处理,实现了防盗链,只允许*.ebandao.cn连接设定的后缀名文件,
假如是其他域名则直接转到error.gif图片去

[ 本帖最后由 qdfushuai 于 2010-3-7 04:09 编辑 ]