Ubuntu 24.04
Sponsored Link

Apache2 : Configure WebDAV2024/05/17

 

Configure WebDAV Folder.

[1]

Configure SSL/TLS Setting, refer to here.

[2] For example, Create a directory [/var/www/webdav] and it makes possible to connect to WebDAV folder only by HTTPS.
root@www:~#
apt -y install apache2-utils
root@www:~#
mkdir /var/www/webdav

root@www:~#
chown www-data:www-data /var/www/webdav

root@www:~#
chmod 770 /var/www/webdav

root@www:~#
vi /etc/apache2/sites-available/webdav.conf
# create new

Alias /webdav /var/www/webdav
<Location /webdav>
    DAV On
    SSLRequireSSL
    Options None
    AuthType Basic
    AuthName WebDAV
    AuthUserFile /etc/apache2/.htpasswd
    <RequireAny>
        Require method GET POST OPTIONS
        Require valid-user
    </RequireAny>
</Location>

# add a user : create a new file with [-c]

root@www:~#
htpasswd -Bc /etc/apache2/.htpasswd ubuntu

New password:    
# set password

Re-type new password:
Adding password for user ubuntu
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 11.
Open File Explorer and and Click the [Add a network location] on the top menu bar.
[4] Click the [Next] button.
[5] Click the [Next] button.
[6] Input the URL of WebDav folder.
[7] Authentication is required, input username and password you added in section [1] by [htpasswd].
[8] Input WebDav Folder Name. Any name is OK, it's used on your Windows Computer.
[9] Click the [Finish] button.
[10] Just accessed to the WebDav Folder. Verify to create new files normally.
Matched Content