全球主机交流论坛
标题:
关于nginx防盗连
[打印本页]
作者:
強哥
时间:
2010-9-17 15:50
标题:
关于nginx防盗连
一般网上的文章.都是说最简易的防盗联方式是
location ~* \.(gif|jpg|png|swf|flv)$ {
valid_referers none blocked www.xxx.com xxx.com ;
if ($invalid_referer) {
return 403;
}
}
复制代码
我把此段话加进到nginx.conf的最下方.系统一直提示
Starting nginx: [emerg]: "location" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:53
[FAILED]
的错误.请问这是啥原因?(nginx是自己编译的.不是一键安装包.使用完全正常)
作者:
jiangchunlin
时间:
2010-9-17 15:50
提示:
作者被禁止或删除 内容自动屏蔽
作者:
serverpoint
时间:
2010-9-17 16:37
提示:
作者被禁止或删除 内容自动屏蔽
作者:
強哥
时间:
2010-9-17 17:18
标题:
回复 3# 的帖子
谢谢您的指导.已经照你说的放对了位置.但结果不起作用.把jpg图片贴到他站测试还是能显示.请问要开启啥功能或是哪里我没注意到?
作者:
kkey
时间:
2010-9-17 17:31
估计是缓存作用
作者:
強哥
时间:
2010-9-17 17:51
大哥.请赐教.原本的代码是
server
{
listen 80;
server_name abc.com;
index index.html index.htm index.php;
root /home/www/wwwroot;
location ~ .*\.php?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log off;
}
复制代码
要实现防盗连.到底要放在哪里?请您放到正确位置.小弟受教了.谢谢
作者:
強哥
时间:
2010-9-17 19:46
标题:
回复 9# 的帖子
感谢这位大哥不厌其烦的教导.已成功.感谢
欢迎光临 全球主机交流论坛 (https://fd.vvwvv.eu.org/)
Powered by Discuz! X3.4