Squirrel Hole

江心一庐


  • Home
  • Archive
  • Categories
  • Tags
  • 我 | I
  •  

© 2025 白色乌鸦|White Crow

Theme Typography by Makito

Proudly published with Hexo

Set WebDAV on Server

Posted at 2018-01-23 making 

Because of limit free sync space of Zotero, I want to set a WebDAV server in my Aliyun server. WebDAV (Web-based Distrubuted Authoring and Versioning) bases on HTTP/1.1, which enables applications to read and write files in web server, even control versions. Both Apache and Nginx can hold WebDAV. Since Nginx has been install in my Aliyun server for Hexo, I only test on Nginx.

Because the standard Nginx provides partial support WebDAV implementation with GET, HEAD, PUT, DELETE, MKCOL, COPY, MOVE methods, I need to enable the standard ngx_http_dav_module as well as ngx_http_dav_ext_module. You can compile this extended module nginx-dav-ext-module as ref 1, or install libnginx-mod-http-dav-ext by apt-get.

Here are two method. You can new a location below default http port(80)(ref 2), or new a server on other port(what I do). Nginx can check the configure file below /etc/nginx/sites-enabled, so following configure was created to a file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
server {
listen 9876; # port

# set cilent body size to 1 G
client_max_body_size 1024M;
location / {
root /root/Zotero; # location of WebDAV in filesystem
autoindex on;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
create_full_put_path on;
dav_access user:rw group:r all:r;
auth_basic "Store for Zoter";
auth_basic_user_file /etc/nginx/user.passwd;#password info
}
}

Password info is created by

1
htpsswd -c /etc/nginx/user.passwd hf

To avoid 413 error, you can type as following in configure file[ref 3]. client_max_body_size 1024M

Because I am using Aliyun server, I have to enable this port in the Aliyun control center.[ref] I don't know what about other servers.

After restarting Nginx, you can open WebDAV as ip:9876 with username and password.

Reference

    1. [编译Nginx]https://jameszhan.github.io/2015/02/25/setup-webdav-with-nginx-in-osx.html
    1. Nginx 文件配置
    1. 413 错误
    1. 添加安全组规则

 Previous post: 校内远程调取实验数据 Sharing Experiment Data only in SUSTech Next post: 女士品茶 The Tasting Lady 

© 2025 白色乌鸦|White Crow

Theme Typography by Makito

Proudly published with Hexo