全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2115|回复: 8

[nginx] 正在研究的nginx dz伪静态规则和防盗链规则记录下分享大家

[复制链接]
发表于 2010-3-7 04:06:40 | 显示全部楼层 |阅读模式
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   ^/   ;
                #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 编辑 ]

评分

参与人数 1威望 +30 收起 理由
cpuer + 30 感谢分享

查看全部评分

 楼主| 发表于 2010-3-7 04:07:36 | 显示全部楼层
#Zone limit
    location / {
    limit_conn   one  1;
    imit_rate  120k;
  }
限制并发数(limit_conn),限制下载速率(limit_rate)

评分

参与人数 1威望 +30 收起 理由
cpuer + 30 感谢分享

查看全部评分

 楼主| 发表于 2010-3-7 04:08:18 | 显示全部楼层
晕图片还真的图片了,那个图片形式是
 楼主| 发表于 2010-3-7 04:08:40 | 显示全部楼层
我晕又变叉叉了。。。
 楼主| 发表于 2010-3-7 04:13:12 | 显示全部楼层
希望大家贡献自己试验过的规则。。让大家都能快速用上一个稳定快速的web环境
发表于 2010-3-7 09:39:45 | 显示全部楼层

回复 5# 的帖子

 楼主| 发表于 2010-3-7 13:21:50 | 显示全部楼层
我是不是很快就升级了呢。。
发表于 2010-3-7 13:24:44 | 显示全部楼层

回复 7# 的帖子

已经中级了。
 楼主| 发表于 2010-3-7 21:47:50 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-7 11:46 , Processed in 0.075440 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表