Nginx配置支持HTTP PUT/DELETE方法
-
nginx需要支持--with-http_dav_module;
-
修改nginx配置文件,/etc/nginx/conf.d/default.conf
location / { root /usr/share/nginx/html; index index.html index.htm; #主要是下面这行 dav_methods PUT DELETE; }
-
注意/usr/share/nginx/文件夹权限
[root@localhost nginx]# ll /usr/share/ | grep nginx drwxrwxrwx 3 nginx nginx 18 Aug 10 02:44 nginx [root@localhost nginx]# [root@localhost share]# ll /usr/share/nginx/ total 0 drwxr-xr-x 2 nginx nginx 84 Sep 16 02:36 html [root@localhost share]#
-
测试PUT请求,查看nginx服务器目录
[root@localhost share]# ll /usr/share/nginx/html/abc -rw-rw-rw- 1 nginx nginx 10 Sep 15 18:35 /usr/share/nginx/html/abc [root@localhost share]# [root@localhost share]# cat /usr/share/nginx/html/abc 1234567890[root@localhost share]# [root@localhost share]#