说明:命令适用于centos,其他系统请自行替换
1、安装相关依赖
1 2 |
yum install expat-devel yum -y install libxslt-devel |
2、编译安装
这里需要用到 nginx-dav-ext-module ,下载zip并解压到nginx目录下
1 |
./configure --with-http_dav_module --add-module=nginx-dav-ext-module |
3、相关配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
server { listen 80; server_name your_servername; access_log logs/webdav.access.log; location / { root /webdav; autoindex on; dav_methods PUT DELETE MKCOL COPY MOVE; dav_ext_methods PROPFIND OPTIONS; create_full_put_path on; dav_access user:rw group:rw all:r; auth_basic "Authorized Users Only"; auth_basic_user_file /nginx/auth/.htpasswd; } } |
其中 auth_basic_user_file /nginx/auth/.htpasswd; 这一句是访问用户与密码配置,自己设置保存目录(需为绝对路径)
4、增加访问用户(如果需要)
这里需要安装相关工具,用于生成用户名与密码
1 |
yum -y install httpd-tools |
1 |
htpasswd -c /nginx/auth/.htpasswd user01 |
会提示输入密码
然后启动nginx,测试访问