Main Tutorials

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 Author

author image
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

Subscribe
Notify of
12 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Alexis
6 years ago

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?

Shivajee
3 years ago

what if i want to have it open for all, no authentication?

sathish
8 years ago

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

Srikanth Gujarathi
9 years ago

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
10 years ago

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
10 years ago

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
10 years ago

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
11 years ago

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

AkeHayc
11 years ago

Good article for me!
Big Thank’s

velocity
12 years ago

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

dsv.nextret
11 years ago
Reply to  mkyong

Looks like it’s a matter of defining the DAVLockDB as per the Apache error log I got:

[Wed Jul 18 16:07:12 2012] [error] [client 127.0.0.1] The lock database could not be opened, preventing access to the various lock properties for the PROPFIND.  [500, #0]
[Wed Jul 18 16:07:12 2012] [error] [client 127.0.0.1] A lock database was not specified with the DAVLockDB directive. One must be specified to use the locking functionality.  [500, #401]

Being myself a very smart ass, I added this in my DAV conf just before the Alias the name of an existing DavLock directory that I created empty (yes, I runz WAMP)

  DavLockDB "C:/_exe/E21600/Fuentes/PoC/wagon/DavLock"

And so happened to work smoothly and flawlessly.