WebDAV, also known as “Web-based Distributed Authoring and Versioning”, is an extension of the Hypertext Transfer Protocol. It allows users to collaboratively edit and manage files on a remote web server using HTTP protocol. You can share Word or Excel documents or a music collection with your friends and other people by simply giving them a URL. WebDAV also allow us to upload and download files on the Apache server. There are several benefits of WebDAV over other solutions such as FTP or Samba.

In this article I will explain how to install and configure WebDav with the Apache2 Web Server on Ubuntu-14.04.

Installing WebDAV

By default the WebDAV module comes with apache2 installation in Ubuntu-14.04. However, it is not enabled by default.

You need to enable it first. You can enable the WebDAV modules using the a2enmod command.

This will create a symbolic link from “/etc/apache2/mods-available” to “/etc/apache2/mods-enabled.”

Now, restart Apache to activate the new configuration.

Configure WebDav Directory

After enabling the module, you will need to create the required directory where you will configure webdav.

Now, create a directory under Apache web root.

You will also need to change the permission in order to allow Apache to write to it.

Setting Password Protection

A WebDAV server without authentication is not secure. It is recommended to add authentication to your WebDAV server.

You need to create an authentication procedure for accessing the directory content by creating an htpasswd file.

Create a hidden .htpasswd file in the “/etc/apache2” configuration directory with the user “webuser.”

Now you need to assign group ownership of the file to “www-data,” and then lock down the permissions for everyone else:

Configure Virtual Host

Next, you need to create a virtual host file for the webdav directory.

To do so, navigate to “/etc/apache2/sites-available/”:

Create a new site configuration file called “webdev.conf.”

Add the following content:

After creating the virtual host files, you need to enable a new virtual host.

You can do this by running:

Testing WebDav Using a Web Browser

Finally, you need to test whether WebDav is properly enabled or not.

Open your favorite web browser and navigate to the url “http://your-server-ip/webdav/.” You will be prompted with a username and password to access the web page.

Testing WebDav Using File Manager

On your Ubuntu Linux machine, open the file manager and press the “Connect to Server” option on the left sidebar. Type the server address “dav://your-server-ip/webdav/,” and press Enter.

You will be prompted for a username and password. Enter them and press Connect.

Once you have connected, the directory should appear under the file manager.

Conclusion

In this article we have gone through how to configure webdav with the Apache server. Now, you have enough knowledge to configure it in production environment. Feel free to comment below if you have any questions.

Our latest tutorials delivered straight to your inbox