项目场景: nginx请求路径相同,但请求方式不同分部转发到不同服务的情况 nginx配置如下 location /api { if ($request_method ~ GET) { proxy_pass http://127.0.0.1:8111; } if ($request_method ~ POST) { proxy_pass http://127.0.0.1:8112; } }