Nginx防盗链及Rewrite

网友投稿 248 2022-11-04

Nginx防盗链及Rewrite

Nginx防盗链及Rewrite一、配置防盗链Web源主机(192.168.163.10)防盗链准备vim /usr/local/nginx/conf/nginx.conf{......server {......location ~.(jpg|gif|swf)$ {valid_referers .test.com test.com;if ( $invalid_referer ) {rewrite ^/ 403;}}......}}

mkdir -p /usr/local/nginx/html/bbs/postecho "this is 1.html" >> /usr/local/nginx/html /bbs/post/1.htmlecho "192.168.163.8 bbs.kgc.com" >> /etc/hosts

systemctl restart nginx

vim /usr/local /nginx/ conf/nginx. confserver {listen 80;server_ name bbs.kgc.com; #域名修改charset utf-8; access_1og /var/1og/nginx/kgc.com-access.1og;

if ($request_uri ~ ^/100-(100|200)-(\d+).html$) { rewrite (.+) permanent; } location / { root html; index index.html index.htm; . }

}

location ~* ^/up1oad/.*\.php$ { rewrite (.+) permanent; } location / { root html; index index.html index.htm; }

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:新iPhone终于要用Type-C接口?Lightning将被弃
下一篇:高分面试从Hotspot源码层面剖析java多态实现原理
相关文章

 发表评论

暂时没有评论,来抢沙发吧~