您的位置:首页 > 科技 > 能源 > Nginx配置WebDAV网盘

Nginx配置WebDAV网盘

2024/9/24 5:25:34 来源:https://blog.csdn.net/qq233325332/article/details/139233357  浏览:    关键词:Nginx配置WebDAV网盘
下载第三方扩展

下载第三方扩展nginx-dav-ext-module

https://github.com/arut/nginx-dav-ext-module.git

编译

编译前确保安装了这些库及其开发包:

sudo apt install libxml2 libxml2-dev libxslt1-dev

编译配置:

添加扩展:--with-http_dav_module

./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_dav_module --add-module=/root/nginx-dav-ext-module-3.0.0
编译并安装Nginx:
make
sudo make install
设置用户名和密码:

使用htpasswd工具创建用户名和密码文件,该文件用于WebDAV的基本身份验证。如果没有安装htpasswd,可以使用以下命令安装:

sudo apt install apache2-utils

创建用户名和密码文件:

sudo htpasswd -c /etc/nginx/.htpasswd your_username
Nginx webdav配置:
	server {listen       8083;server_name  localhost;root /var/www/webdav;location / {autoindex on;dav_methods  PUT DELETE MKCOL COPY MOVE;create_full_put_path  on;dav_access  user:rw group:rw all:rw;dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;client_max_body_size 5G;client_body_timeout 600s;auth_basic "Restricted";auth_basic_user_file /usr/local/nginx/conf/.htpasswd;}}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com