How To Configure WebDAV Access with Apache on Ubuntu

Configure WebDAV Folder.

1. Configure SSL/TLS Setting, refer to here.
2. For example, Create a directory [/home/webdav] and it makes possible to connect to WebDAV folder only by HTTPS.
root@www:~# apt -y install apache2-utils
root@www:~# mkdir /home/webdav
root@www:~# chown www-data. /home/webdav
root@www:~# chmod 770 /home/webdav
root@www:~# nano /etc/apache2/sites-available/webdav.conf
# create new
Alias /webdav /media/hdd1tb.backup/ftp_home/webdav
<Location /webdav> 
      DAV On 
      Options Indexes MultiViews FollowSymLinks 
      AllowOverride None 
      Order allow,deny 
      allow from all 
      SSLRequireSSL 
      AuthType Basic 
      AuthName WebDav 
      AuthUserFile /etc/apache2/webdav.password
      <RequireAny> 
         Require method GET POST OPTIONS 
         Require valid-user 
      </RequireAny> 
</Location>
# add a user : create a new file with [-c]
root@www:~# htpasswd -c /etc/apache2/webdav.password pi
New password:     # set password
Re-type new password:
Adding password for user pi
root@www:~# a2enmod dav*
#Enabling module dav. Considering dependency dav for dav_fs: 
Module dav already enabled 
Enabling module dav_fs. 
Enabling module dav_lock. 
To activate the new configuration, you need to run: systemctl restart apache2 
root@www:~# a2ensite webdav
Enabling site webdav. 
To activate the new configuration, you need to run: systemctl reload apache2 
root@www:~# systemctl restart apache2
3. Configure WebDAV client on client computer.

This example is on Windows 10. Open [PC] and move to [Computer] tab and Click [Add a network location] icon.

Input the URL of WebDav folder.

Authentication is required, input username and password you added in section [1] by [htpasswd].

Input WebDav Folder Name. Any name is OK, it’s used on your Windows Computer.

Click [Finish] button.

Just accessed to WebDav Folder.

Leave a Reply

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