October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Set Up WebDAV with Nginx on Ubuntu (HTTPS, Authentication, and Client Compatibility)

A complete Ubuntu guide to Nginx WebDAV: verify the DAV module, configure storage and permissions, enable uploads and deletes, secure the endpoint with HTTPS and authentication, test each method, and handle clients that require unsupported PROPFIND or LOCK operations.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To set up WebDAV on Ubuntu, run Nginx with its ngx_http_dav_module, map a dedicated writable directory, enable the required DAV methods, protect the endpoint with authentication and HTTPS, then test the exact methods your client uses. Nginx handles PUT, DELETE, MKCOL, COPY, and MOVE; it does not provide the PROPFIND, LOCK, or UNLOCK behavior that many full WebDAV clients expect.

What Nginx WebDAV supports—and what it does not

Nginx’s built-in DAV module is intended for automated file management over WebDAV. Its supported operations are:

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Method Typical purpose Built-in Nginx DAV support
PUT Upload or replace a file Supported
DELETE Remove a file or directory where permitted Supported
MKCOL Create a collection (directory) Supported
COPY Copy a resource to another path Supported
MOVE Move or rename a resource Supported
PROPFIND List collections and read WebDAV properties Not provided by the built-in module
LOCK and UNLOCK Coordinate concurrent editing Not provided by the built-in module

The module is not guaranteed to be compiled into every Nginx binary. A client that only uploads, creates directories, copies, moves, and deletes can work with the built-in module. A client that discovers folders with PROPFIND, checks capabilities with OPTIONS, or requires locking needs a DAV extension module or a separate WebDAV implementation.

Plan the deployment before changing Nginx

  • Use a dedicated hostname such as files.example.com, rather than exposing DAV from an unrelated public website.
  • Keep the storage directory outside the public site tree when practical.
  • Decide which Linux account and group Nginx uses. Ubuntu installations commonly use www-data, but verify the user setting in your Nginx configuration.
  • Choose the client methods you actually need. Do not add unsupported methods to dav_methods and assume they will work.
  • Use HTTPS before allowing passwords or file content to cross the network.

The examples below use /srv/webdav as the storage root and /dav/ as the URL prefix. With a root directive in that location, a request for /dav/report.pdf maps to /srv/webdav/dav/report.pdf. Create the matching directory structure, or change the paths consistently.

Install Nginx and confirm the DAV module

Install Nginx from Ubuntu packages or the official Nginx repository, then inspect the resulting binary:

sudo apt update
sudo apt install nginx
nginx -V 2>&1

In the build options, look for --with-http_dav_module. If it is absent, the running binary cannot process the DAV methods described here. Install a package or repository build that includes the module, or use a separately maintained WebDAV implementation. Confirm the binary again after changing packages so that you are testing the executable actually used by the service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ubuntu’s normal configuration directory is /etc/nginx/, and its standard logs are under /var/log/nginx/. Keep this setup in a dedicated site file rather than editing the distribution’s main file unnecessarily.

Create a storage directory with least-privilege permissions

Create both the mapped directory and Nginx’s temporary request-body directory. The temporary path must be writable because uploaded request bodies may be spooled there before Nginx writes them to the destination.

sudo mkdir -p /srv/webdav/dav
sudo mkdir -p /var/lib/nginx/body
sudo chown -R www-data:www-data /srv/webdav /var/lib/nginx/body
sudo chmod 750 /srv/webdav
sudo chmod 750 /srv/webdav/dav
sudo chmod 750 /var/lib/nginx/body

Replace www-data with the account and group shown by your Nginx configuration. If several trusted processes must access the files, use a dedicated group and grant only the group permissions required. Do not make the tree world-writable: WebDAV methods can create, replace, move, and delete data.

Write the initial WebDAV server block

Create a site file such as /etc/nginx/sites-available/webdav. The following block shows the DAV directives and a temporary TLS configuration. Replace the hostname and certificate paths with the values for your server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
server {
    listen 443 ssl;
    server_name files.example.com;

    ssl_certificate     /etc/letsencrypt/live/files.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/files.example.com/privkey.pem;

    auth_basic           WebDAV;
    auth_basic_user_file /etc/nginx/.htpasswd;

    location /dav/ {
        root /srv/webdav;
        client_body_temp_path /var/lib/nginx/body;

        dav_methods PUT DELETE MKCOL COPY MOVE;
        create_full_put_path on;
        dav_access user:rw group:rw all:r;
    }
}

Each directive has a distinct job:

  • root maps the URL to the filesystem. In this example, /dav/ remains part of the path below /srv/webdav.
  • client_body_temp_path identifies writable temporary storage for request bodies.
  • dav_methods enables the five operations implemented by Nginx’s built-in DAV module.
  • create_full_put_path on permits Nginx to create missing intermediate directories for a PUT request. Leave it off if clients must create directories explicitly with MKCOL.
  • dav_access controls permissions on newly created files and directories. The example grants read/write to the owner and group and read access to everyone else; tighten the all setting when anonymous filesystem reads are inappropriate.

If you want the URL prefix excluded from the filesystem path, redesign the mapping rather than silently assuming that root behaves like an alias. Test one known filename and verify its actual location before uploading valuable data.

Add authentication and restrict who can modify files

Basic Authentication is supported by Nginx, but credentials are only protected from interception when the connection uses HTTPS. Create an htpasswd file with the system utility available on your Ubuntu installation, then reference it with auth_basic_user_file:

sudo htpasswd -c /etc/nginx/.htpasswd alice

Use -c only when creating the file. Omitting it for later users prevents overwriting the existing accounts. Keep the file readable by Nginx but not publicly served.

You can also restrict write-capable methods to an administration network while leaving read requests available to a broader set of addresses. Place this inside the DAV location:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
limit_except GET {
    allow 192.0.2.0/24;
    deny all;
}

Replace the example network with the real trusted range. This pattern denies non-GET requests outside that range; authentication still applies according to the surrounding server and location configuration. If every operation should be private, require authentication for the whole location and use network rules as a second control.

Enable the site and check the configuration

On Ubuntu’s standard layout, enable the site with a symbolic link and remove or avoid conflicting server blocks for the same hostname:

sudo ln -s /etc/nginx/sites-available/webdav /etc/nginx/sites-enabled/webdav
sudo nginx -t
sudo systemctl reload nginx

nginx -t must report a successful syntax check before a reload. If it fails, correct the first reported error, run the test again, and only then reload. A reload applies the new configuration without stopping existing workers.

When a request fails, inspect the error log while reproducing it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo tail -f /var/log/nginx/error.log

Permission errors, missing temporary directories, and incorrect path mappings usually appear there more clearly than in a graphical WebDAV client.

Put the endpoint behind HTTPS

Production WebDAV should use TLS. Add a separate port-80 server block that redirects ordinary traffic to the HTTPS hostname:

server {
    listen 80;
    server_name files.example.com;
    return 301 https://$host$request_uri;
}

Obtain a certificate from a trusted certificate authority. For a Let’s Encrypt HTTP-01 challenge, port 80 must be reachable from the public internet while the certificate is issued. Certbot’s Nginx plugin can install the certificate directives in the matching server block and reload Nginx. Keep port 80 reachable for the validation workflow even if normal users are redirected immediately to HTTPS.

After certificate installation, verify that the certificate hostname matches the DAV hostname and that clients connect to the HTTPS URL. Never send the Basic Authentication password to an unencrypted HTTP endpoint.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test each required WebDAV operation

Test from a machine that can reach the hostname. The examples use curl; substitute a real password and a file that is safe to upload.

Upload a file with PUT

curl -u alice -T sample.txt -X PUT https://files.example.com/dav/sample.txt

A successful upload should create or replace the mapped file. If the response is an authorization error, check both the htpasswd credentials and the limit_except network rule.

Create a collection with MKCOL

curl -u alice -X MKCOL https://files.example.com/dav/projects

If the parent path does not exist, create it first or enable create_full_put_path for uploads that create intermediate paths.

Copy and move resources

curl -u alice -X COPY 
  -H 'Destination: https://files.example.com/dav/archive/sample.txt' 
  https://files.example.com/dav/sample.txt

curl -u alice -X MOVE 
  -H 'Destination: https://files.example.com/dav/archive/sample.txt' 
  https://files.example.com/dav/sample.txt

The destination must be a valid URL understood by the client and server. URL-encode spaces and other special characters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Delete a resource

curl -u alice -X DELETE https://files.example.com/dav/archive/sample.txt

Deletion is irreversible unless you have a separate backup or snapshot system. Restrict this method more tightly than ordinary reads when possible.

Check unsupported discovery and locking methods

curl -u alice -X PROPFIND https://files.example.com/dav/
curl -u alice -X LOCK https://files.example.com/dav/sample.txt
curl -u alice -X UNLOCK https://files.example.com/dav/sample.txt

Do not treat a failure here as proof that the upload configuration is broken. The built-in module does not implement these methods. A client that requires them may stop during connection setup even though PUT and DELETE work correctly.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose common failures

Symptom Likely cause What to check
nginx -t reports an unknown DAV directive The binary was built without the DAV module. Run nginx -V and look for --with-http_dav_module; install a build that contains it.
Uploads return 403 or 500 The storage or temporary directory is not writable by the Nginx worker. Confirm ownership, mode bits, the configured user, and the client_body_temp_path directory.
Files appear in an unexpected directory The URI prefix is being appended by root. Map one test URL manually and create the corresponding directory, or revise the location mapping deliberately.
Directory creation fails MKCOL is not allowed by the location or the parent directory is missing. Check dav_methods, parent permissions, and whether create_full_put_path matches your workflow.
Writes are denied only from some networks The limit_except allow/deny list is working as configured. Verify the source address seen by Nginx and update the trusted CIDR range.
A client reports that WebDAV is unavailable during login It requires PROPFIND, OPTIONS, LOCK, or UNLOCK. Inspect the client’s method requirements and use a DAV extension or a complete WebDAV server if those methods are mandatory.
Certificate issuance cannot complete The HTTP-01 challenge cannot reach port 80. Open port 80 to the internet during issuance, confirm DNS points to the server, and let the certificate tool update the correct server block.

Choose the right implementation for your client

Requirement Built-in Nginx DAV DAV extension module Dedicated WebDAV server
Core file operations Lightweight and suitable for PUT, DELETE, MKCOL, COPY, and MOVE. Depends on the extension’s build and maintenance. Usually provided as part of a fuller protocol implementation.
Property queries and directory discovery Not available through the built-in module. Possible when the extension implements the required methods. Generally the better fit when these are central requirements.
Locking No built-in LOCK/UNLOCK support. Possible only if the chosen module supplies it. Preferable for clients that rely on locking semantics.
Authentication and TLS Use Nginx authentication controls and HTTPS. Still depends on the surrounding Nginx configuration. Evaluate the server’s own authentication and TLS integration.
Filesystem permissions Controlled by the Linux account, directory modes, and dav_access. Verify behavior after installation and upgrades. Check how the service account maps to the storage tree.
Maintenance Simple when your Ubuntu Nginx package includes the module. Requires tracking compatibility with the Nginx build. Adds another service and its update, logging, and security responsibilities.

Use the built-in module when its five methods match the application and you value a small configuration footprint. Select an extension or a dedicated implementation when the client cannot operate without property queries, locking, or other methods outside that set.

Operational security checklist

  • Serve the DAV endpoint over HTTPS and redirect plain HTTP.
  • Require authentication before accepting uploads, moves, or deletes.
  • Limit write-capable methods by source network when feasible.
  • Store data outside the public website tree and grant Nginx only the access it needs.
  • Keep the temporary request-body directory private and writable only by the service account or its group.
  • Review Nginx access and error logs for unexpected methods, repeated authentication failures, and path errors.
  • Back up the storage tree separately; successful DELETE and MOVE operations do not provide recovery.
  • Retest the exact client methods after Nginx or module upgrades.

Final decision

A secure, usable Nginx WebDAV endpoint on Ubuntu is a combination of five things: a binary containing ngx_http_dav_module, a correctly writable filesystem mapping, explicit DAV method directives, HTTPS with authentication, and a client whose protocol expectations match Nginx’s partial implementation. Validate each layer independently. If the client requires PROPFIND or locking, change the implementation rather than trying to force unsupported methods into the Nginx configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.