我正在使用nginx作为前端构建webdav后端应用程序。
要在上传过程中减少光盘操作,请启用client_body_in_file_only
。
问题是,这迫使nginx写下所有请求主体并减慢小请求(例如PROPFIND查询)。
有没有办法只为PUT方法制作nginx client_body_in_file_only=on
?
答案 0 :(得分:4)
如果$ request_method是" PUT",则返回" 588",这将由具有client_body_in_file_only=on;
的命名位置块处理。
server {
error_page 588 = @saveinfile;
if ($request_method = PUT) {
return 588;
}
location / {
# the usual stuff..
}
location @saveinfile {
client_body_in_file_only on;
# the usual stuff..
}
}