很久以前分享过apache附件分流,现在再分享一下nginx的分流方法

2020-02-25 11:01:37 收藏 14276
很久以前分享过apache附件分流,现在再分享一下nginx的分流方法

很久以前分享的apche分流方法,大家可以先查看一下


https://x1.php168.com/bbs/show-12545.html



https://x1.php168.com/bbs/show-14735.html


对于NGINX的话,规则如下

if (!-d $request_filename){
	set $rule_0 1$rule_0;
}
if (!-f $request_filename){
	set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
	rewrite ^/(.*)public\/uploads\/(.*)$ https://x1.f2.qibosoft.com/public/uploads/$2 redirect;
}



apche的规则是

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)public\/uploads\/(.*)$ https://x1.f2.qibosoft.com/public/uploads/$2 [R,L]



他们分别都实现同样的功能. 当WEB主服务器附件不存在,就读取备份服务器,  也就是说,你可以定时把主服务器的附件移走. 这里就不涉及到OSS



大家不知道放哪个位置的话,可以参考下面的图片




weinxin
我的微信
科学的永恒性就在于坚持不懈地寻求之中,科学就其容量而言,是不枯竭的,就其目标而言,是永远不可企及的。

发表评论

目前评论:0