This is how you set up a WebDAV server as a target for your backups, for example Nextcloud, ownCloud or a NAS: from the form through the connection test to the saved target.
What you need
- the address of the folder on the server, starting with https://,
- user name and password; if the account uses two-factor authentication, an app password,
- a folder that nobody can reach without authorization, not even via a share link.
WebDAV is file access over HTTP. The plugin uses the PHP extension cURL for WebDAV and reads the responses of the server with the PHP extension DOM.
Step 1: Choose the target type
Open the Targets page and click Add target. Choose WebDAV.
- The target types that exist. WebDAV has the globe icon.
- Dismiss closes the selection.
If the web server lacks cURL or DOM, WebDAV is greyed out and has the label Not available on this server. The reason is shown below the selection.
Step 2: Fill in the form
- Name is up to you. The plugin suggests “WebDAV 1”; any name that is not in use yet works.
- Address of the folder is the complete WebDAV address. The plugin creates missing folders.
- User name
- Password is the password of the account or an app password.
- Location indicates whether the target is at the same location as the website: not specified, Same location as the website or Another location (another data centre or another provider). The setting counts for the 3-2-1 rule of the plans.
- Test connection checks the entered values without saving.
Fields with a red star are required. For the address:
- With Nextcloud and ownCloud it has the form
https://<server>/remote.php/dav/files/<user>/<folder>/. - User name and password belong in their fields, not in the address. The form rejects an address with credentials, a question mark or a hash sign: This value is not valid.
- The plugin accepts an address with http://. Password and data are then transmitted in clear text.
The folder must not be publicly reachable
Make sure that nobody can access the folder without authorization, for example via a share link. The plugin never sends test requests to third-party servers. That is why it cannot tell you whether the folder is public.
Step 3: Test the connection
Click Test connection. The test logs in to the server, writes a small file, asks for its size, renames it, reads it back, lists the folder and deletes the file again. With a test file of 1 MiB it measures the upload rate.
- The result of the test: the connection works, a test file was written, read back and deleted.
- The upload method the test determined, and the measured upload rate.
WebDAV itself has no way to continue an interrupted upload. The plugin supports three methods. The test determines which one your server offers:
| Line in the result | Meaning |
|---|---|
| Upload method: the server continues an interrupted upload where it stopped. | The server accepts a part of a file at a given position, for example Apache with mod_dav. The method is called range. |
| Upload method: sections, as Nextcloud and ownCloud offer them. | The sections are uploaded to an upload folder of the server, which assembles them at the end. This only works with an address of the form …/remote.php/dav/files/<user>/…. The method is called chunks. |
| Upload method: every file in one request, because the server cannot continue an upload. | For servers that offer neither of the other two. The method is called whole. Below it you see how large the parts of a backup become at most. |
The last line shows the rate: Measured upload rate: … per second.
Step 4: Save
Click Save. The plugin saves the target, tests the connection once more and reports the result: “…” saved and connected. Plans and backups use a target only after a successful connection test.
- All targets are connected.
- The message names the target: saved and connected.
- The new target is in the list. The green dot means: connected. A target of the type WebDAV is preceded by the globe.
After saving and the successful connection test, the plugin looks at the location of the target. If it finds the folder of another installation there, the tile Backups found at “…” appears. If backups in the folder of this installation are missing from the list of backups at this target, the plugin adds them to the list on its own, or the same tile offers to add them. More about this: Find backups again after a reinstallation.
Step 5: Choose the target in the backup plan
- Your first target: The plugin creates the plan “Daily backup”: daily at a random time, everything, this target, Max. backups 7. The plan is paused until you switch it on.
- Another target: Choose it on the Backup page in the tile Backup plans in a plan. The free version allows one target per plan.
More about this: Schedule backups automatically.
The fields of the Extended view
- Connection timeout (seconds) accepts 3 to 60; the default is 10.
-
Upload method can stay empty: the value the connection test determined is then used. Possible values are
range,chunksandwhole. - Upload rate (bytes per second) can stay empty: the value the connection test measured is then used.
-
Largest request (bytes) applies only with the method
wholeand can stay empty: the value a backup learned when the server refused a request as too large is then used. Values from 1048576 to 268435456 are allowed. - Accepted key of the server is set by Accept this certificate. Empty means: the plugin checks the certificate against the list of trusted authorities.
An empty field whose value the test determines shows automatic. Every connection test determines method and rate anew. The backups keep both up to date: a smaller rate applies at once, a larger one by half. What you enter yourself always takes precedence.
Encryption and certificate
https:// is the normal case. With http:// the result of the connection test contains a warning: The connection is not encrypted: password and data can be read on the way.
With https:// the plugin checks the certificate of the server against the list of trusted authorities that comes with WordPress, together with the name of the server. If the check fails, the test fails and shows the certificate.
- The reason: not issued for this server name, self-signed, from an unknown authority or expired.
- The details of the certificate: who it is issued for, by whom, until when it is valid, and its fingerprint.
- Accept this certificate enters the key of the certificate in the form and tests again.
Above the reason 1 the picture shows the line Message from the client with the original error message from cURL.
Accept only if the fingerprint matches
After accepting, the plugin trusts exactly this key and no longer checks who issued the certificate. Nobody has confirmed that this is the right server: compare the fingerprint with the one your provider states.
After accepting, the result of a successful test contains the warning: The certificate is not checked against the list of trusted authorities; the plugin trusts the key you accepted.
The check is never switched off. If the server later shows a different key, the target no longer passes its test: The server shows a different key than the one you accepted. It may have a new certificate, or someone may be in between. Accept the new certificate only if you know why it has changed.
When the test fails
If the test fails, the result is shown below the fields of the form. In the picture the server refused the login.
- The cause in plain language. The link at the end, Show global log, opens the global log. The details of the test are there.
- Message from the target is the original error message of the WebDAV server.
If cURL reported something too, Message from the client is shown below it. The error messages in both lines are not translated; credentials, folders and server names are masked in them.
| Message | What you can do |
|---|---|
| The target cannot be reached. Check the server name and the port; the host of this website may block the port. | Check the Address of the folder: the name of the server and, if it contains one, the port. |
| The target refused the login. Check user name and password. | Enter the credentials again. If the account uses two-factor authentication, create an app password there and enter it. |
| The certificate of the target did not pass the check. | See the section “Encryption and certificate”. |
| The target redirects to another address. The plugin does not follow a redirect; test the connection of the target to see the new address. | See the next section. |
| The target does not allow everything the plugin needs. | Below the message you see what is missing, for example renaming or reading from a position. The plugin needs it to check, continue and clean up backups. Without this capability the target is not usable. |
| The target asked for a pause: it is busy, or it received too many requests. | Test the connection again later. |
| The target reports that there is no space left. | Free up space on the server, or choose a folder with more space. |
| The target refused the request, or the transfer failed. | If the plugin knows the reason, it is shown below the message: The target refuses uploads of this size. The limit is set at the target. Or: Another program has reserved this file at the server (WebDAV lock). Otherwise the line Message from the target helps. |
When the server redirects
The plugin does not follow a redirect, because the password would otherwise be sent to an address you did not enter. The test fails, and the new address is shown below the message. There is one exception: if the server redirects a folder to the same address with a slash at the end, the plugin repeats the request once with the slash.
- The message: the target redirects to another address.
- The new address the server redirects to.
Enter the new address as Address of the folder if it is the right one.
When an upload is too slow
The plugin works in short steps. With the method whole every file has to arrive within one step. That is why the plugin splits a backup to such a target into smaller parts: it calculates with the upload rate of the target and the maximum time of a step and chooses a size between 1 MiB and 256 MiB. The result of the connection test shows it: A backup that goes to this target is therefore split into parts of at most …, at every target of that backup.
- The result of the test: the connection works.
- The upload method the test determined: every file in one request.
- The maximum size of the parts of a backup that is transferred to this target.
Many servers limit the size of a request. If the server refuses a part as too large (response 413), this target fails for this backup, and the plugin remembers half of the refused size as Largest request (bytes). The next backup creates no larger parts. If you have raised the limit at the server, raise the value or enter the maximum; a connection test does not reset it. With nginx the limit of the server is called client_max_body_size.
If a file still does not arrive in time, the target counts as failed in this backup after three attempts. The message for it: An upload did not arrive before the time of a step ran out: the connection to the target is too slow for it. The plugin then remembers a smaller rate, and the next backup gets smaller parts. Test the connection of the target again to measure the rate anew. How long a step takes at most is set by the setting Maximum time per step: Adapt the plugin to your server.
Good to know
- The backups are stored on the server under
<Adresse>/cloneworx-backup-<code>/<backup>/. You do not have to create the folder of the plugin. - In its folders the plugin places the protection files
index.phpandindex.html, but neither.htaccessnorweb.config: a WebDAV server reads the files that are stored with it. At a WebDAV target the login at the server protects the folder. - If the server asks for a pause during a backup, the plugin waits as long as the server specifies, at most five minutes, and then tries again.
- The plugin deletes files one by one. It removes a folder only if the server lists it as empty.
- You do not download backups that are stored only at a WebDAV target through the plugin, but with your WebDAV program or in the web interface of the server. Restore, check and finding backups read directly from the server.
- If the server reports the free space, the plugin checks before writing a backup whether it is enough. The tile Targets and space in the Extended view shows the free space only for local folders; for a WebDAV target it shows a dash.
- The plugin also uses a proxy from the
wp-config.phpfor WebDAV. The constants are calledWP_PROXY_HOST,WP_PROXY_PORT,WP_PROXY_USERNAME,WP_PROXY_PASSWORDandWP_PROXY_BYPASS_HOSTS.
See also
- Which target suits you?
- The “Targets” page
- Renew the credentials of a target
- Check backups at a target and clean up leftovers
- When a backup fails or ends with warnings
On the command line
WP-CLI not set up yet? How to install WP-CLI.
The command line does not accept the password; that is why you set up a WebDAV target on the Targets page. Everything else also works with WP-CLI:
# Show targets with ID and state wp cloneworx-backup target list # Test the connection wp cloneworx-backup target test webdav-1 # Create a backup plan that backs up to this target wp cloneworx-backup plan add --target=webdav-1 --rhythm=daily --time=03:15 --name="Nachts" # Check the backups at this target wp cloneworx-backup target check webdav-1 # Show leftovers (--dry-run) and clean up wp cloneworx-backup target cleanup webdav-1 --dry-run wp cloneworx-backup target cleanup webdav-1