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 | server { |
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
- [编译Nginx]https://jameszhan.github.io/2015/02/25/setup-webdav-with-nginx-in-osx.html