Configuring WebDav on Raspberry Pi has been a popular topic for people coming to this website and there have been some updates to the process which warrant a new article on the subject. Originally written for Raspian, on a Raspberry Pi 2, there have been some developments which mean that if you are trying to follow the original process then you will probably encounter issues.
I’ve therefore re-written the guide, with a view to making this the process as simple as possible. This therefore is not a secure implementation of WebDav, so this is something to only run on your internal (home) network. Connecting to a WebDav server over https and using authentication would be your next steps if this is your desired outcome, but for things like running a local WebDav server for storing and retrieving files from an iPad this would normally suffice.
Before I walk you through the process, I would like to refer you to this guide: https://www.digitalocean.com/community/tutorials/how-to-configure-webdav-access-with-apache-on-ubuntu-18-04. This has been the process I have followed and adapted slightly for this article. Raspberry Pi OS and Ubuntu share many common characteristics, so this was a big help when coming to understand the latest Apache configuration required.
Final note, this process assumes you have already got a Raspberry Pi up and running and are connected via SSH. Not sure how to get this setup? Then refer to this article first.
Configuring WebDav on Raspberry Pi Overview
The steps I am going to run through in this process are:
- Install vim on a clean installation of Raspberry Pi OS
- Install apache
- Enable the WebDav modules within Apache
- Restart Apache
- Make configuration changes
- Restart Apache again
- Test
Configuring WebDav on Raspberry Pi Process – Installing Apps
OK, so on a fresh install of Raspberry Pi OS I am first going to install vim. Vim is a text editor which I will later use to edit the configuration files. You may prefer to use Nano or vi to edit text files but my preference is towards vim. If you are unfamiliar with using vim and want to learn I suggest having a look at this post: https://opensource.com/article/19/3/getting-started-vim
To install vim, I’ll first make sure my package list are up to date and everything is upgraded to the latest version:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim
You will be prompted to accept the installations – just following the instructions and press Y when prompted.
Next up is installation of Apache. Do this with the following command:
sudo apt-get install apache2
Again, press Y when prompted for the installation
I would suggest you test Apache has install OK and is accessible to another computer on your network. Do this by typing in the following into your browser:
http://[hostname]
The [hostname] will be the name you called you Pi when setting up. Typically this is http://raspberrypi.local – as it is the default. You should be prompted with an Apache default webpage:

Enabling WebDav Modules
Once that has run through we are going to enable the various WebDav modules. I like to install all of the modules I may use now and in the future as they are very lightweight and don’t tax the Raspberry Pi much. To do this, execute the following commands:
sudo a2enmod dav
sudo a2enmod dav_fs
sudo a2enmod dav_lock
sudo a2enmod auth_digest
You will have noticed whilst enabling these that for these to activate you will need to restart Apache. So this is a good point to do that:
sudo systemctl1 restart apache2
Apache / WebDav Configuration
Cool. So, next up we are going to make a folder for you WebDav files to sit in:
sudo mkdir -p /var/www/webdav
The -p switch tells mkdir to add any directories which are not present already.
Now we are going to set the owner and group of this new directory:
sudo chown www-data:www-data /var/www/webdav
Now we have somewhere for you files to live, we also need to set a location for your configuration files.
sudo mkdir -p /usr/local/apache/var/
And then give the relevant permissions like you did with your file locations:
sudo chown www-data:www-data /usr/local/apache/var
This is where things start getting a little trickier, as we will need to update configuration files using vim.
First up, I would suggest you type in the following commands to find the configuration file you are going to edit:
cd /etc/apache2/sites-enabled
ls
What you should see is a single file, which is the config file for your virtualhost. Probably looks a little bit like this:

Once you know what the configuration file name you can edit with the following command:
sudo vim /etc/apache2/sites-enabled/000-default.conf
Add the following to the first line of the file:
DavLockDB /usr/local/apache/var/DavLock
Now we are going to add the Alias and Directory inside the <VirtualHost> tag:
Alias /webdav /var/www/webdav
<Directory /var/www/webdav>
DAV On
</Directory>
This is how it looks in my 000-default.conf file:

Once the file has been saved and closed, we are on the home straight… Last thing to do is another restart of Apache:
sudo systemctl1 restart apache2
And then test!
The easiest way to check this is looking good is to go into your browser and type in:
http://[hostname]/webdav
You will not be able to interact with WebDav on Chrome, but you will quickly find out if you have any major problems. Next you can try a proper WebDav enabled app – such as Documents by Readdle and make sure this works fully.
Next Steps
So, you’ve managed to get this far.. What next?
I’d suggest looking at running WebDav over a secure connection (SSL / https) and setting up password authentication. This will encrypt the traffic and make sure there are no unwanted snoopers looking at your activity. Also, if you wish to publish the WebDav share onto the internet, then this combination is essential.
Having trouble, drop us a comment and we’ll try and help out.
2 Responses
Thanks for this. It does allow a Webdav connection with no UserID nor password. Are you going to post tutorials on setting up Webdav account access control as well as secure (https) connections?
hello,
I follow you step success create a webdav server,
but I can not upload and download anything,
I try ———————————————————
sudo chown fatkpi:fatkpi /var/www/webdav
sudo chown fatkpi:fatkpi /usr/local/apache/var
sudo chown 777 /var/www/webdav
sudo a2enmod rewrite
————————————————————–
just still not work
please help me last step 🙁