静态缓存防盗链笔记

回复 收藏
1.配置静态缓存
在apache/conf/httpd.conf 开启expires模块
LoadModule expires_module modules/mod_expires.so

2.在apache/conf/extra/httpd.vhosts.conf添加如下配置:



        ExpiresActive on
        ExpiresByType image/gif "access plus 1 days"
        ExpiresByType image/jpeg "access plus 24 hours"
        ExpiresByType image/png  "access plus 24 hours"
        ExpiresByType text/css "now plus 2 hour"
        ExpiresByType application/x-javascript "now plus 2 hours"
        ExpiresByType application/javascript "now plus 2 hours"
        ExpiresByType application/x-shockwave-flash "now plus 2 hours"
        ExpiresDefault "now plus 0 min"



3.检查配置,重启apache服务,OK!




2.配置防盗链
在apache/conf/extra/httpd.vhosts.conf中添加如下配置:

        SetEnvIfNoCase Referer "^http://summy\.com" local_ref
        SetEnvIfNoCase Referer "^http://.*\.due\.com" local_ref
      
                Order Allow,Deny
                 Allow from env=local_ref
        

其中 SetEnvIfNoCase Referer "^*" local_ref中*号填写自己的网址,或者你允许的referer


2016-04-05 13:36 举报
已邀请:

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: