nginx 代理 location不同的前缀校验不同的文件格式,怎么配置?-灵析社区

满脑子智慧溢出

server { listen 9023; server_name localhost; # location ~* "\.(xlsx|png|doc|docx|pdf|xls|rar|zip|jpg|jpeg|bmp)$" { # rewrite ^/.(xlsx|png|doc|docx|pdf|xls|rar|zip|jpg|jpeg|bmp)$ /$1 break; # proxy_pass http://192.168.3.14:9090; # } } 我期望 以location test1 开始的请求验证后缀为png格式,test2开始的请求不验证格式,怎么配置这个location呢?

阅读量:85

点赞量:0

问AI
万码用户
同问
,
你好我叫张倩话
server { listen 9023; server_name localhost; location /test1/ { if ($request_uri ~* \.png$) { proxy_pass http://192.168.3.14:9090; } return 403; } location /test2/ { proxy_pass http://192.168.3.14:9090; } }