2.3-Apache配置防盗链
2015-08-22 22:48
537 查看
为了防止被别的网站,盗用自己网站的元素,可以配置防盗链。
<IfModule mod_expires.c>
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/x-shockwave-flash "now plus 2 hours"
ExpiresDefault "now plus 0 min"
</IfModule>
SetEnvIfNoCase Referer "^http://.*\.llzdwyp\.com" local_ref Referer为变量 此行为白名单
SetEnvIfNoCase Referer ".*\.wyp\.com" local_ref 此行为白名单
SetEnvIfNoCase Referer "^$" local_ref 变量为空,可以用网页单独打开元素
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif|js|css)"> 配置防盗链的元素
Order Allow,Deny
Allow from env=local_ref 只允许变量相等时访问
# Deny from all 可以省略
</filesmatch>
<IfModule mod_expires.c>
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/x-shockwave-flash "now plus 2 hours"
ExpiresDefault "now plus 0 min"
</IfModule>
SetEnvIfNoCase Referer "^http://.*\.llzdwyp\.com" local_ref Referer为变量 此行为白名单
SetEnvIfNoCase Referer ".*\.wyp\.com" local_ref 此行为白名单
SetEnvIfNoCase Referer "^$" local_ref 变量为空,可以用网页单独打开元素
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif|js|css)"> 配置防盗链的元素
Order Allow,Deny
Allow from env=local_ref 只允许变量相等时访问
# Deny from all 可以省略
</filesmatch>
相关文章推荐
- Apache PIO基本使用
- Apache2 使用Tips
- Apache虚拟主机的配置
- Win7+Apache+PHP+MySQL配置
- org.apache.hadoop.ipc.RemoteException: java.io.IOException:XXXXXXXXXXX could only be replicated to 0 nodes, instead of 1
- Mac OS 终端起动、关闭、重启apache的方法
- Linux 安装配置 Apache
- linux 下eclipse配置apache服务器,选中server时server name为灰色状态
- 解决:mvn archetype:create Abstract class or interface 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
- 应用apache FileUtils把网页另存为文件
- 搭建apache+php+mysql环境七部曲
- Apache Sentry 第一弹:Server启动、连接Hue、分组详解
- 2.1-apache配置静态缓存
- CentOS7.0下,apache不能正常运行的解决思路
- 2.1-Apache不记录指定文件类型日志
- 2.0-apache日志切割
- solr启动时报错org.apache.solr.common.SolrException: undefined field text的解决办法
- Apache Spark 入门简介
- lamp环境搭建 centos5.5 +Apache2.2.9 +mysql5.1.18+php5.3.6 源码安装,【附配置环境】
- Mac配置apache,mysql