[linux 2019-07-09] apache配置防盗链
发布时间:2020-12-13 22:42:43 所属栏目:Linux 来源:网络整理
导读:1.检查是否安装 mod_rewrite 模块 apachectl -t -D DUMP_MEDULES |grep rewrite 2.安装 mod_rewrite 模块 (若已安装,则跳过) # http解压目录 ./configure --prefix=/usr/local/httpd --enable-rewrite --enable-so --enable-charset-lite --enable- cgimak
1.检查是否安装 mod_rewrite 模块 apachectl -t -D DUMP_MEDULES |grep rewrite 2.安装 mod_rewrite 模块 (若已安装,则跳过) #http解压目录 ./configure --prefix=/usr/local/httpd --enable-rewrite --enable-so --enable-charset-lite --enable-cgi make && make install 3.配置 mod_rewrite 模块启用 vim httpd.conf <Directory "/usr/local/httpd/htdcos"> ... Order allow,deny Allow from all #以下为添加内容 RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://shijt.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://shijt.com/$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.shijt.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.shijt.com/$ [NC] RewriteRule .*.(gif|jpg|swf)$ http://www.shijt.com/error.png </Directory> 4.再次执行第1步代码,检查模块是否安装 5.重启httpd服务 效果如图: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |