Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/nginx/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nginx限制除本地主机IP以外的所有主机的速率';s_Nginx_Localhost_Limit - Fatal编程技术网

Nginx限制除本地主机IP以外的所有主机的速率';s

Nginx限制除本地主机IP以外的所有主机的速率';s,nginx,localhost,limit,Nginx,Localhost,Limit,因此,在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

因此,在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文件而不受限制率配置的限制,任何帮助都将非常好:)

在Nginx config的HTTP块中

geo $remove_rate_limit {
default 0;
172.16.0.0/24 1;
}
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 Config的服务器位置块中

geo $remove_rate_limit {
default 0;
172.16.0.0/24 1;
}
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;
}

}