http – 如何在Nginx服务器上允许PUT文件请求?

我正在使用一个需要在HTTP服务器上输出文件的应用程序.我使用Nginx作为服务器,但返回405 Not Noted错误.以下是使用cURL进行测试的示例:

curl -X PUT \
-H 'Content-Type: application/x-mpegurl' \
-d /Volumes/Extra/playlist.m3u8 http://xyz.com

我从Nginx那里得到了什么:

允许PUT需要做什么?

任何线索都会很棒!

最佳答案
要添加HTTP和WebDAV方法,如PUT,DELETE,MKCOL,COPY和MOVE,您需要使用HttpDavModule(./configure –with-http_dav_module)编译nginx.首先检查nginx -V,也许你已经有了HttpDavModule(I installed nginx from the Debian repository and I already have the module).

然后改变你的nginx-config:

location / {
    root     /var/www;
    dav_methods  PUT;
}

您可以在nginx docs entry for the HttpDavModule获得更多信息.

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。