From ce48f072cb2a16b12f54faa9285b975763171ba4 Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Fri, 14 Jun 2024 00:24:40 +0800 Subject: [PATCH] add apache and nginx webdav --- README.md | 2 + docs/remote_services/webdav_apache/README.md | 62 +++++++++++++++++++ .../webdav_apache/apache_rs_settings.png | 3 + docs/remote_services/webdav_nginx/README.md | 51 +++++++++++++++ .../webdav_nginx/nginx_rs_setting.png | 3 + 5 files changed, 121 insertions(+) create mode 100644 docs/remote_services/webdav_apache/README.md create mode 100644 docs/remote_services/webdav_apache/apache_rs_settings.png create mode 100644 docs/remote_services/webdav_nginx/README.md create mode 100644 docs/remote_services/webdav_nginx/nginx_rs_setting.png diff --git a/README.md b/README.md index 1784fd2..43d4714 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,8 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a - [AList(中文)](./docs/remote_services/webdav_alist/README.zh-cn.md) | [AList (English)](./docs/remote_services/webdav_alist/README.md) - [坚果云](./docs/remote_services/webdav_jianguoyun/README.zh-cn.md) | [JianGuoYun/NutStore](./docs/remote_services/webdav_jianguoyun/README.md) - [Open Media Vault](./docs/remote_services/webdav_openmediavault/README.md) + - [Nginx (`ngx_http_dav_module`, `nginx-dav-ext-module`, with Docker)](./docs/remote_services/webdav_nginx/README.md) + - [Apache (with Docker)](./docs/remote_services/webdav_apache/README.md) - Very old version of Obsidian needs [configuring CORS](./docs/remote_services/webdav_general/webav_cors.md). - Your data would be synced to a `${vaultName}` sub folder on your webdav server. - Password-based end-to-end encryption is also supported. But please be aware that **the vault name itself is not encrypted**. diff --git a/docs/remote_services/webdav_apache/README.md b/docs/remote_services/webdav_apache/README.md new file mode 100644 index 0000000..1090cb5 --- /dev/null +++ b/docs/remote_services/webdav_apache/README.md @@ -0,0 +1,62 @@ +# Apache Webdav + +The following tutorial uses Apache with Docker in Linux, using the image [`bytemark/webdav`](https://hub.docker.com/r/bytemark/webdav/). + +You can also checkout the official doc from Bytemark [here](https://docs.bytemark.co.uk/article/run-your-own-webdav-server-with-docker/). The tutorial you are reading here is a little different from Bytemark's article. + +Assuming you want a webdav server on Linux satisfying that: + +1. Data is saved in your host machine's `./dav1` folder, +2. WebDAV is accessed by a user `user1` with password `password1`, +3. WebDAV is accessed on the host machine and port 8080: `127.0.0.1:8080`. +4. Use Basic auth type. + +Install docker nd set its permission properly. Then run this in terminal: + +```bash +mkdir ./dav1 # create the local folder + +docker container run --rm \ + -p 127.0.0.1:8080:80 \ + -v ./dav1:/var/lib/dav \ + -e USERNAME=user1 \ + -e PASSWORD=password1 \ + -e AUTH_TYPE=Basic \ + bytemark/webdav +``` + +We do not have `--detach` prameter here, so the server will be closed as soon as you terminate the program or close terminal. You might want to adjust the settings further by yourself. + +Then, in Remotely Save's setting, set these (auth type should always be `Basic`): + +``` +Server: http://127.0.0.1:8080 +User: user1 +Password: password1 +Auth Type: Basic +Depth Header Sent To Servers: only supports depth='1' +``` + +![Apache RS Setting](./apache_rs_settings.png) + +Then the server should be connected! You can sync now! + +In you host machine's file system, you should find some files and folders were added into the folder `./dav1`. + +``` +ls ./dav1/ +## data DavLock DavLock.dir DavLock.pag + +ls ./dav1/data/ +## +``` + +# Auth type + +You can change the auth type while calling Docker, between `Basic` and `Digest`. And please rememberto adjust the Remotely Save's settings. Both works. + +# Notice + +1. **Never expose your webdav server to public networks without protections or without strong passwords!** +2. I personally recommend using tailscale to build a LAN instead of expoing the service to public. +3. If you want to connect to the server from iOS (iPhone / iPad), the https is required. I personally recommend using caddy as the reverse proxy. Caddy can also be combined with tailscale. diff --git a/docs/remote_services/webdav_apache/apache_rs_settings.png b/docs/remote_services/webdav_apache/apache_rs_settings.png new file mode 100644 index 0000000..065ede2 --- /dev/null +++ b/docs/remote_services/webdav_apache/apache_rs_settings.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:264e50d3adaeb4fc4e76b00273459d7d021f1b44af7f07b00a5c40741e65194d +size 658482 diff --git a/docs/remote_services/webdav_nginx/README.md b/docs/remote_services/webdav_nginx/README.md new file mode 100644 index 0000000..ba19999 --- /dev/null +++ b/docs/remote_services/webdav_nginx/README.md @@ -0,0 +1,51 @@ +# Nginx Webdav + +The following tutorial uses Nginx with Docker in Linux, using the image [docker-nginx-webdav-nononsense](https://github.com/dgraziotin/docker-nginx-webdav-nononsense). It contains `ngx_http_dav_module` and `nginx-dav-ext-module`. + +The description is adapted from the pull request [`dgraziotin/docker-nginx-webdav-nononsense#123`](https://github.com/dgraziotin/docker-nginx-webdav-nononsense/pull/123) by Remotely Save author. + +Assuming you want a webdav server on Linux satisfying that: + +1. Data is saved in your host machine's `./dav1` folder, +2. WebDAV is accessed by a user `user1` with password `password1`, +3. WebDAV is accessed on the host machine and port 8080: `127.0.0.1:8080`. +4. (Only Basic auth type is supported.) + +Install docker nd set its permission properly. Then run this in terminal: + +```bash +mkdir ./dav1 # create the local folder + +docker container run --rm \ + -p 127.0.0.1:8080:80 \ + -v ./dav1:/data \ + -e WEBDAV_USERNAME=user1 \ + -e WEBDAV_PASSWORD=password1 \ + -e PUID=1000 \ + -e PGID=1000 \ + dgraziotin/nginx-webdav-nononsense +``` + +We do not have `--detach` prameter here, so the server will be closed as soon as you terminate the program or close terminal. You might want to adjust the settings further by yourself. + +Then, in Remotely Save's setting, set these (auth type should always be `Basic`): + +``` +Server: http://127.0.0.1:8080 +User: user1 +Password: password1 +Auth Type: Basic +Depth Header Sent To Servers: only supports depth='1' +``` + +![Nginx RS Setting](./nginx_rs_setting.png) + +Then the server should be connected! You can sync now! + +In you host machine's file system, you should find some files and folders were added into the folder `./dav1`. + +# Notice + +1. **Never expose your webdav server to public networks without protections or without strong passwords!** +2. I personally recommend using tailscale to build a LAN instead of expoing the service to public. +3. If you want to connect to the server from iOS (iPhone / iPad), the https is required. I personally recommend using caddy as the reverse proxy. Caddy can also be combined with tailscale. diff --git a/docs/remote_services/webdav_nginx/nginx_rs_setting.png b/docs/remote_services/webdav_nginx/nginx_rs_setting.png new file mode 100644 index 0000000..5282fe5 --- /dev/null +++ b/docs/remote_services/webdav_nginx/nginx_rs_setting.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92059e0819d25640a02d2494ba9da0bfa7a69003cdba36ced985bed9e29b0354 +size 254978