This blog will step you through the correct setup for WebDAV on Ubuntu. There is a lot of examples online which half explain or are cut and past of the other post on it or from ubuntuforums.org – – this guide will show you how to set up WebDAV and save yourself on permissioning issue and access rejections; it will show you the correct configuration for assuming you have the cname, a record or/and aaaa records of: webdav.yoursite.com pointed to the Ubuntu service.
First once you are in Ubuntu, press alt + ctrl + t to enter the shell bash prompt and run the following commands:-
sudo apt-get update sudo apt-get install apache2 apache2-utils nano
Now we have to make the path the webdav operates on this can be in your home directory if you like but for the moment we will make it in /var/www; run the following commands:-
sudo mkdir /var/www/webdav sudo chown -R www-data:www-data /var/www/
Next run the following commands to enable Web Dav with apache 2:-
sudo a2enmod dav sudo a2enmod dav_fs
Now we have to make the apache2 config file for webdav.yoursite.com run the following command:-
sudo nano /etc/apache2/sites-available/webdav.yoursite.com.conf
and put the following text in there changing any section in bold, that you know needs to change:-
<VirtualHost *:80> ServerName webdav.yoursite.com ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/webdav ErrorLog /var/log/apache2/webdav.yoursite.com-error.log CustomLog /var/log/apache2/webdav.yoursite.com-access.log common <Directory /var/www/webdav> Options Indexes FollowSymLinks MultiViews AllowOverride none DAV On AuthType Basic AuthName "Webdisk Authentication for WebDAV (here)" AuthUserFile /var/www/webdav.yoursite.com-passwd.dav Require valid-user </Directory> </VirtualHost>
now sav webdav.yoursite.com.conf in nano by pressing CTRL + O then CTRL + X and then run the following commands:-
sudo htpasswd -c /var/www/webdav.yoursite.com-passwd.dav username
This will allow you to set username and passwords for the WebDAV; now it is time to enable the WebDAV and restart apache2; with the following commands:-
sudo a2ensite webdav.yoursite.com sudo ufw allow 80 sudo service apache2 reload sudo service apache2 restart
So that is is that is how you set up WebDAV Properly so you don’t have access issues and faults, and there is no path after wards to connect to in Ubuntu Desktop you would goto the path dav://webdav.yoursite.com or http://webdav.yoursite.com for the WebDAV path specified!