proxy_pass 结尾斜杠规则 不带斜杠:保留原始请求路径。 location /api { proxy_pass http://backend; # 转发到 http://backend/api } 带斜杠:剥离 location 匹配的路径前缀。 location /api/ { proxy_pass http://backend/; # 转发到 http://backend/(剥离 /api/) } 只使用于 proxy_pass 中不包含uri (ip:端口/无后缀url)