0
时不允许我需要重定向所有文件上传请求https://example.com/year2017/monthsept/upload/去https://example.com/upload/NGINX 405上传文件
在nginx的配置我有以下的位置/服务器块内重写规则。但是,我收到405错误。
location ~ ^/year2017/monthsept/upload/(.*) {
rewrite ^year2017/monthsept/upload/$1 /upload/$1 permanent;
}
$ curl --verbose --upload-file test.txt https://example.com/year2017/monthsept/upload/
PUT /year2017/monthsept/upload/test.txt HTTP/1.1 < HTTP/1.1 405不允许 * HTTP错误发送的结束之前,停止发送 *关闭连接0
我已经更新了重写规则,所以经常但没有喜悦。
正确的nginx规则是什么?
嗨塔伦, 此时nginx的,我要补充的nginx的是2个上游服务器负载平衡器。额外的proxy_pass如何处理负载均衡?删除这样的IP地址? location〜^/year2017/monthsept/upload /(.*){ proxy_pass/upload/$ 1; } – Mark
是的,这应该工作太 –
这有助于我现在有工作作为使用 '位置〜^/year2017/monthsept /上传/(.*){ proxy_pass example.com/upload/$1预期; }' – Mark