Hi everyone, today we'll learn how to setup WebDav with Apache2 Web Server on Fedora 21 Operating System. WebDAV stands for "Web-based Distributed Authoring and Versioning". It is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers. The WebDAV protocol makes the Web a readable and writable medium. It provides a framework for users to create, change and move documents on a server; typically a web server or web share. The most important features of the WebDAV protocol include the maintenance of properties about an author or modification date, namespace management, collections, and overwrite protection. Maintenance of properties includes such things as the creation, removal, and querying of file information.
Here are some quick and easy steps to setup WebDav with Apache Web Server on Fedora 21.
1. Installing Apache Web Server
First of all, we'll need to make sure that Apache Web Server is installed on our system. If its not installed, we'll need to install by running the following command.
$ sudo yum install httpd
Now, after we install Apache Web Server, we'll want to enable it to startup in every boot and start the service.
$ sudo systemctl enable httpd.service
$ sudo systemctl start httpd.service
2. Configuring WebDav Directory
After installing Apache Web Server, we'll now create the required directory where we'll configure webdav in. Here, we've choosed /var/www/linoxide/webdav as WebDav enabled directory.
$ sudo mkdir -p /var/www/linoxide/webdav
Then, we'll want to make user "apache" having group "apache" as the owner of the directory using the following command.
$ sudo chown apache:apache /var/www/linoxide/webdav
3. Setting Password Protection
We can create an authentication procedure for accessing the directory content by creating an htpasswd file. To create it, we need to run the following command in a shell or a terminal.
$ sudo htpasswd -c /var/www/linoxide/passwd.dav admin
Note: Here, admin is a username, you can change it as per the security.
After running the above command, we'll be asked to enter a password for the user admin .
Right now, anyone can view the username and hashed password in the file. We will assign group ownership of the file to apache and then lock down the permissions for everyone else:
$ sudo chown root:apache /var/www/linoxide/passwd.dav
$ sudo chmod 640 /var/www/linoxide/passwd.dav
4. Configuring Apache Vhost
Now, we'll configure our Apache Web Server's vhost configuration. To do that, we'll need to open the config file using our favorite text editor.
$ sudo nano /etc/httpd/conf/httpd.conf
ServerAdmin [email protected]
Options Indexes MultiViews
allow from all
Alias /webdav /var/www/linoxide/webdav/
Now, after configuring the config file, we'll want to restart our Apache Web Server.
$ sudo systemctl restart httpd.service
5. Testing WebDav
To test whether WebDav is properly enabled or not, we'll use a browser and a client to check.
Test using a Web Browser
To test if the authentication is working correctly or not, we'll navigate to our server's IP address or domain name using our favorite web browser.
We'll need to navigate to http://our_IP_address_or_domain/webdav . Then, everything worked fine as illustrated, a prompt for the username and password should appear. Here, we'll need to enter the username and password we set before.
Test using a Client
We'll use a WebDav client called cadaver. To install it in our Fedora 21 Server, we'll need to run the following command.
$ sudo yum install cadaver
After installing cadaver, we'll test our webdav using the command below.
$ cadaver http://your_IP_address_or_domain/webdav
If all went well, we'll be asked to enter our username and password we kept before. Then, We should be granted access which means WebDAV is working fine.
Now, we can operate the client and host at the same time using commands that are similar to regular Linux commands. Some of the useful examples are as follows.
dav:/webdav/> put file
To view/list the contents
To create a new directory and to navigate
dav:/webdav/> mkdir new-dir
dav:/webdav/> cd new-dir
To create files
dav:/webdav/> edit index.html
Now, after done, we can exit using the below command.
Finally, we have successfully set up WebDav with Apache Web Server on our Fedora 21. WebDav is an awesome security module by Apache2 which is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers. So, if you have any questions, suggestions, feedback please write them in the comment box below. Thank you ! Enjoy :-)