fix: move limit_req_zone to http context (conf.d)
This commit is contained in:
parent
c56ae7bb7a
commit
1a8fc81549
|
|
@ -7,26 +7,21 @@ server {
|
|||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# 视频文件最大 500MB
|
||||
client_max_body_size 500M;
|
||||
|
||||
# 防止单 IP 提交过多任务
|
||||
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=5r/m;
|
||||
|
||||
location /health {
|
||||
proxy_pass http://opensora_api;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location /v1/ {
|
||||
limit_req zone=api_limit burst=10 nodelay;
|
||||
limit_req zone=opensora_limit burst=10 nodelay;
|
||||
|
||||
proxy_pass http://opensora_api;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# 视频下载可能需要较长时间
|
||||
proxy_read_timeout 3600;
|
||||
proxy_send_timeout 3600;
|
||||
proxy_connect_timeout 10;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
# 放入 /etc/nginx/conf.d/,在 http 上下文中定义限流区
|
||||
# setup.sh 会自动复制此文件
|
||||
limit_req_zone $binary_remote_addr zone=opensora_limit:10m rate=5r/m;
|
||||
Loading…
Reference in New Issue