Ginx Webdav 模块支持 HTTP 协议文件上传 。

      最后更新:2021-11-09 09:15:31 手机定位技术交流文章

      1、简介

      实验步骤

      1. 下载 ngx-dav-ext-moule 软件包。

      2. Nginx 重组

      我已经安装了Nginx, 但我们需要重新安装, 并将 nginx 的 ngx- dav- ext- model 添加到 nginx 。

      查看原有的编译参数

      上一个 Nginx 备份

      下载与您原Nginx版本( 例如 1. Eighteen) 相同的源软件包( 创用CC BY- NC- ND 2. 0) 。

      如果出现下列任何错误:

      ./configure: error: the HTTP XSLT module requires the libxml2/libxslt
      libraries. You can either do not enable the module or install the libraries.
      
      yum -y install libxml2 libxml2-dev
      yum -y install libxslt-devel
      

      然后在重新编译

      记住这一点很重要 这不是个好主意make install否则 旧的金条封面有问题

      nginx 应替换 。

      我们成功地增加了一个模块,如下图所示。
      在这里插入图片描述

      3、创建配置文件

      vim /etc/nginx/conf.d/webdav.conf
      server {
      listen       80;
      server_name  webdav.chinaedu.net;
      access_log  /var/log/nginx/webdav.access.log  main;
      location / {
          root   /data/sqldown/;
          autoindex on;
          dav_methods PUT DELETE MKCOL COPY MOVE;
          dav_ext_methods PROPFIND OPTIONS;
          create_full_put_path  on;
          dav_access user:rw group:r all:r;
          auth_basic "Authorized Users Only";
          auth_basic_user_file /etc/nginx/.htpasswd;
      }
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
            root   /usr/share/nginx/html;
          }
      }
      
      mkdir -p /data/sqldown/
      chown nginx:nginx /data/sqldown/
      chmod 700 /data/sqldown/
      

      4、配置身份验证

      四.2. 必须安装 httpd 工具 。

      yum -y install httpd-tools
      

      四.3. 制作密码文件和密码。

      htpasswd -c /etc/nginx/.htpasswd user1
      [root@yearning sqldown]# nginx -t
      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
      nginx: configuration file /etc/nginx/nginx.conf test is successful
      [root@yearning sqldown]# nginx -s reload
      

      5. Curl用于测试webdav:

      上传文件: https://webdav.com/scwscs/scscscs/scscscs/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/s/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc/sc//sc/sc/sc//sc/sc/s//sc/sc/sc/sc/s//sc/sc/s/c/c//s/s/c/s/sc/sc/sc/c/c/sc/s/c/s/c/c/sc/sc/c/c/sc/c/c/c/c/c/c/s/c/sc/sc/sc/sc/sc/c/c/c/s/c/s/s/c/c/c/c/s/s/s/c/c/c/c/c/c/c/c/c/c/c/s/c/c/s/s/s/c/c/c/c/c/s/s/s/s/c/c/s/c/c/c/c/c/c/s/c/c/s/c/c/s/s/c
      

      本文由 在线网速测试 整理编辑,转载请注明出处,原文链接:https://www.wangsu123.cn/news/12974.html

          热门文章

          文章分类