How to enable WebDAV in Apache Server 2.2.x – Windows

Web-based Distributed Authoring and Versioning (WebDAV) allow users to read and write server folders and files via HTTP. For more detail, please refer to WebDAV Wiki and WebDAV community.

Here’s a guide to show you how to enable WebDav in Apache Server 2.2.x, under Windows platform. See following steps :

1. Load WebDav in Apache Server

WebDAV comes with Apache server 2.x, you just need to enable it. Edit “%APACHE_PATH%/conf/http.conf“, uncomment the following load and include statements.

File : http.conf


LoadModule alias_module modules/mod_alias.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule setenvif_module modules/mod_setenvif.so

# Distributed authoring and versioning (WebDAV)
Include conf/extra/httpd-dav.conf

2. Create User & Password for WebDAV

For WebDAV authentication access, issue this command :


htdigest -c "%APACHE_INSTALLED_PATH%/user.passwd" DAV-upload admin

See sample output :


C:\Program Files\Apache Software Foundation\Apache2.2\bin>htdigest -c "C:/Program Files/Apache Softw
are Foundation/Apache2.2/user.passwd" DAV-upload admin
Adding password for admin in realm DAV-upload.
New password: ********
Re-type new password: ********

It means, create an user “admin” with password “given by user” and stored it in file – “%APACHE_INSTALLED_PATH%/user.passwd“, under realm “DAV-upload”.

3. Configure WebDAV folder

Created a “sites” folder under “%APACHE_PATH%/sites“. Edit “%APACHE_PATH%/extra/httpd-dav.conf” , add following content :

File : httpd-dav.conf


Alias /sites "C:/Program Files/Apache Software Foundation/Apache2.2/sites"

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/sites">
    Dav On

    Order Allow,Deny
    Allow from all

    AuthType Digest
    AuthName DAV-upload

    Options Indexes
	
    AuthUserFile "C:/Program Files/Apache Software Foundation/Apache2.2/user.passwd"
    AuthDigestProvider file

    # Allow universal read-access, but writes are restricted
    # to the admin user.
    <LimitExcept GET OPTIONS>
        require user admin
    </LimitExcept>
</Directory>

It means enable the WebDAV access for “sites” folder, and use “user.passwd” file for authentication, under realm “DAV-upload” as well (AuthName DAV-upload).

4. Restart Apache Server

Done, restart Apache server service. Now, WebDAV service is enabled in your server’s “sites” folder.

For example
If your server ip is 127.0.0.1, then you can WebDAV access your “sites” folder via this URL : “http://127.0.0.1/sites

5. Verify with WebDAV Client

Download and install bitkinex, a powerful free WebDAV client for Windows. The following figure shows bitkinex connected to a web folder via WebDAV :

WebDAV Windows client bitkinex
Note
For other WebDAV related projects or clients, refer to this site

Reference

  1. http://www.webdav.org/
  2. http://en.wikipedia.org/wiki/WebDAV
  3. http://www.bitkinex.com
  4. http://www.davexplorer.org/
  5. http://httpd.apache.org/docs/2.0/mod/mod_dav.html

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
12 Comment threads
2 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
10 Comment authors
AlexissathishSrikanth GujarathiMayur MitkariAmidamaru Recent comment authors
newest oldest most voted
Alexis
Guest
Alexis

I am working with XAMPP and I followed all the steps as indicated in the tutorial, however, I could not connect with BitKinex to the WebDAV server. Any idea how to do it?

sathish
Guest
sathish

I tried mentioned steps but i am not understating clearly ,please tell me about how to do in xampp server

Srikanth Gujarathi
Guest
Srikanth Gujarathi

Hello yong,
i need to create file and copy file into mapped drive ,by the above configuration i can able to read files but not able to write file in to the webdav.

Thanks in Advance
Srikanth.

Mayur Mitkari
Guest
Mayur Mitkari

Hello
Mr Mkyong , i have implemented this configuration and it worked

fine , but i have little doubt . When i was downloading large

file thorugh browser if internet connection is disabled then

there was temporary downloaded file when i was enabling internet

connection the download was restarted not resumed . If i want to

resume the download what are the configuration changes needs to

be implemented.
Regards

Mayur Mitkari
Guest
Mayur Mitkari

Thanks MkYong , I have implemented this configuration and its working , but i am facing a issue, in case when i start downloading a large file and if internet connection is down or is disabled the download creates a temporary file , when i connect with network again the download get restarted there is no resume facility, is there any way i can resume my download in this case. If there is any please specify

Regards
Mayur

Amidamaru
Guest
Amidamaru

I’ve followed you steps by the book, httpd-dav.conf and user.passwd files has been created. Xampp got restarted but I still get the error trying to connect to http://127.0.0.1/sites


Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

Any other thoughts?

Thanks much.

Nico
Guest
Nico

Take into consideration to run the htdigest command with a Admin console, otherwise the file will not be created.

trackback
Publishing your mvn-site page | Adventures in tech

[…] MkYong has a nice post on how to Enable WebDAV on Apache – under Windows in particular. This is used in the case where you would want to take the output of the mvn site:deploy and send it to a Web Server. Share this:TwitterFacebookPinterestDiggEmailTumblrStumbleUponRedditPrintLike this:LikeBe the first to like this. This entry was posted in Uncategorized. Bookmark the permalink. ← Maven Sites – Reloaded […]

AkeHayc
Guest
AkeHayc

Good article for me!
Big Thank’s

velocity
Guest
velocity

Hi Mkyong,

I tryied the steps mentioned in your article “How to enable WinDav in Apache Server 2.2.x- windows” by i could’nt browse my sites folder using WinDAV after launching Apache.
Even if i have access to the files folder with winDAV, i can’t see the files it contains.

Can you help me with that ?
thx

trackback
Maven + WebDAV – Embedded error: Failed to transfer file: … Return code is: 405

[…] How to enable WebDAV on Apache Server […]

trackback
How to deploy site with “mvn site-deploy” – WebDAV example

[…] 1. Enabled WebDAV See this guide to learn how to enable WebDAV access on Apache server 2.x. […]