banner
L,.G

L,.G

读书|新知|生活禅

Using Nginx to build WebDAV in the Baota panel

image

Recently, Dropbox is about to expire, and faced with the high renewal price, I shed tears of poverty😭.

But if I don't renew, iCloud often has glitches, and syncing with DEVONthink becomes a problem.

I took a look at the only remaining lightweight application server on Tencent Cloud, which still has 70GB of space. So why not set up a WebDAV service to make use of the space?

Let's do it💪

Confirming the Module#

Because WebDAV is built on Nginx, it requires the http_dav_module module support.

You can use the nginx -V command in SSH to check if the http_dav_module module is installed.

image

If you don't see the http_dav_module module, you need to uninstall Nginx and then recompile and install it with the custom module.

image

Fill in the custom module with the following information:

  • Module Name: http_dav_module
  • Module Description: webdev
  • Module Parameters: -with-http_dav_module --add-module=/root/nginx-dav-ext-module
  • Pre-Script: git clone https://github.com/arut/nginx-dav-ext-module.git /root/nginx-dav-ext-module

After filling in, click submit and wait for the compilation and installation to complete. Then use the nginx -V command to check if the module has been successfully installed.

Setup#

Create a new website in the control panel, and choose Pure Static for the PHP Version.

Then enable password access in the website directory and set your own account and password.

image

Finally, go to the website settings and select the configuration file. Paste the following settings code before the } symbol at the end:

location / {
root     /www/wwwroot/xxx; # WebDAV directory path (please modify it yourself)
client_max_body_size 102400M; # Large file support parameter
charset utf-8; # Encoding parameter (not setting it may cause Chinese garbled)
autoindex on;
dav_methods PUT DELETE MKCOL COPY MOVE;
# The following options require nginx-dav-ext-module
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
create_full_put_path  on;
}

image

After modifying, save it.

Then go to the website directory and delete the index.html file.

WebDAV is now set up.

Demonstration#

WebDAV sync is set up in DEVONthink.

image

Open the WebDAV website that has been set up in the browser.

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.