VPS侦探论坛

 找回密码
 注册
查看: 10486|回复: 7

军哥,我做的防盗链,301,怎么不起作用啊

[复制链接]
发表于 2011-6-3 09:34:55 | 显示全部楼层 |阅读模式

军哥帮看看,我做的图片防盗链,和301,好像不起作用啊!LNMP铺设,房子“域名.conf”里

server
{
  listen       80;
  server_name www.xxx.com xxx.com;
  index index.html index.htm index.php default.html default.htm default.php;
  root  /home/wwwroot;
                                error_page 404 /404.html;

  include none.conf;
  location ~ .*\.(php|php5)?$
   {
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
   }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }

  location ~ .*\.(js|css)?$
   {
    expires      12h;
   }
                                   
                              location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                valid_referers none blocked www.xxx.com;
                                if ($invalid_referer) {
                                rewrite ^/ http://www.xxx.com/404.jpg;
                                #return 404;
                                }
                       }

access_log off;
}

server{
       listen 80;
       server_name d5god.com;
       rewrite ^(.*) http://www.xxx.com permanent;

       #return 500;
}
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-6-3 13:06:56 | 显示全部楼层


/usr/local/nginx/sbin/nginx -t 测试看看,不行的话就不清楚了。原来测试过没问题。

以后请不要重复发帖!!!!!!!
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2011-6-3 14:02:36 | 显示全部楼层

回复 1# 的帖子


就是因为/usr/local/nginx/sbin/nginx -t ,全部提示正确啊!才发帖问的啊
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-6-3 17:51:21 | 显示全部楼层



location ~* \.(gif|jpg|png)$ {

我这里是这样。。。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-6-22 21:03:01 | 显示全部楼层

无用。。。这个方法冒失没用  依旧可以被其他页面盗链。。。。

nginx有个模块叫做 ngx_http_referer_module,通过这个模块,可以很方便的做防盗链设置
一般常用的方法是在 server或者location段中加入
valid_referers   none blocked www.mydomain.com mydomain.com;

就不知道LNMP0.7的着个  ngx_http_referer_module 是否开启。。。。

军哥运维代购:http://shop63846532.taobao.com/

发表于 2011-9-21 11:51:37 | 显示全部楼层

绑定了
我的500G流量都被图片跑光了
发表于 2011-12-18 22:09:36 | 显示全部楼层

我的1000g都怀疑被跑光了。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-5-11 12:45:19 | 显示全部楼层

你放错位置了。我的设置好了的。我已写好完整帖子,有兴趣的可以参考下我的帖子http://www.net5you.com/thread-4035-1-1.html
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-22 23:24 , Processed in 0.027921 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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