Nginx limit_rate 除了本地主机 IP
Nginx limit_rate to all except local host IP's
所以在 Nginx 中,我的位置配置允许 MP4 流,但我想限制所有流量的速率,除了我指定的那些特定的本地主机 IP。
所以我不想有传输限制的IP地址如下:
172.16.0.1
172.16.0.2
172.16.0.3
172.16.0.4
172.16.0.5
172.16.0.6
etc etc
MP4流的Nginx配置:
location ~ \.mp4$ {
mp4;
limit_rate_after 1m;
limit_rate 1m;
root '//172.16.0.1/Storage1/server/domain/public_www';
expires max;
valid_referers none blocked domain.com *.domain.com;
if ($invalid_referer) {
return 403;
}
}
所以是的,任何关于我应该进行或更改/做的配置调整的帮助,只允许我的本地主机 IP 接收 mp4 文件而不受 limit_rate 配置的限制会很棒 :)
在 Nginx 配置的 HTTP 块中
geo $remove_rate_limit {
default 0;
172.16.0.0/24 1;
}
在 Nginx 配置的服务器位置块中
location ~ \.mp4$ {
mp4;
limit_rate_after 1m; #All users will be limited
limit_rate 1m; #All users will be limited
#Order this after the limit_rate to remove the limit for specific IP's
if ($remove_rate_limit) { #If IP matches
limit_rate_after 0; #Make 0 what is default setting for no limit.
limit_rate 0; #Make 0 what is default setting for no limit.
}
root '//172.16.0.1/Storage1/server/domain/public_www';
expires max;
valid_referers none blocked domain.com *.domain.com;
if ($invalid_referer) {
return 403;
}
}
所以在 Nginx 中,我的位置配置允许 MP4 流,但我想限制所有流量的速率,除了我指定的那些特定的本地主机 IP。
所以我不想有传输限制的IP地址如下:
172.16.0.1
172.16.0.2
172.16.0.3
172.16.0.4
172.16.0.5
172.16.0.6
etc etc
MP4流的Nginx配置:
location ~ \.mp4$ {
mp4;
limit_rate_after 1m;
limit_rate 1m;
root '//172.16.0.1/Storage1/server/domain/public_www';
expires max;
valid_referers none blocked domain.com *.domain.com;
if ($invalid_referer) {
return 403;
}
}
所以是的,任何关于我应该进行或更改/做的配置调整的帮助,只允许我的本地主机 IP 接收 mp4 文件而不受 limit_rate 配置的限制会很棒 :)
在 Nginx 配置的 HTTP 块中
geo $remove_rate_limit {
default 0;
172.16.0.0/24 1;
}
在 Nginx 配置的服务器位置块中
location ~ \.mp4$ {
mp4;
limit_rate_after 1m; #All users will be limited
limit_rate 1m; #All users will be limited
#Order this after the limit_rate to remove the limit for specific IP's
if ($remove_rate_limit) { #If IP matches
limit_rate_after 0; #Make 0 what is default setting for no limit.
limit_rate 0; #Make 0 what is default setting for no limit.
}
root '//172.16.0.1/Storage1/server/domain/public_www';
expires max;
valid_referers none blocked domain.com *.domain.com;
if ($invalid_referer) {
return 403;
}
}