全球主机交流论坛
标题:
正在研究的nginx dz伪静态规则和防盗链规则记录下分享大家
[打印本页]
作者:
qdfushuai
时间:
2010-3-7 04:06
标题:
正在研究的nginx dz伪静态规则和防盗链规则记录下分享大家
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 编辑
]
作者:
qdfushuai
时间:
2010-3-7 04:07
#Zone limit
location / {
limit_conn one 1;
imit_rate 120k;
}
限制并发数(limit_conn),限制下载速率(limit_rate)
作者:
qdfushuai
时间:
2010-3-7 04:08
晕图片还真的图片了,那个图片形式是
作者:
qdfushuai
时间:
2010-3-7 04:08
我晕又变叉叉了。。。
作者:
qdfushuai
时间:
2010-3-7 04:13
希望大家贡献自己试验过的规则。。让大家都能快速用上一个稳定快速的web环境
作者:
cpuer
时间:
2010-3-7 09:39
标题:
回复 5# 的帖子
作者:
qdfushuai
时间:
2010-3-7 13:21
我是不是很快就升级了呢。。
作者:
cpuer
时间:
2010-3-7 13:24
标题:
回复 7# 的帖子
已经中级了。
作者:
qdfushuai
时间:
2010-3-7 21:47
欢迎光临 全球主机交流论坛 (https://lilynana.eu.org/)
Powered by Discuz! X3.4