Link to home
Start Free TrialLog in
Avatar of shacho
shacho

asked on

Setting up WebDAV with Apache2 on Unix (Mac)

I am having a hard time getting WebDAV to work on my Apache Server.  I think I have followed the instructions correctly, but with so many flavors of Unix and Linux and version of Apache, I can't be sure I've got everything straight.  Can someone please walk me through this?  Apache is working and I can access my site directory via http.  Here are the relevant parts of my httpd.conf file:

LoadModule dav_module libexec/apache2/mod_dav.so
LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so

DocumentRoot "/Library/WebServer/Documents"

# First, we configure the "default" to be a very restrictive set of features.
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory /Library/WebServer/Documents>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory /users/MyUserName/Sites/MySubfolder/>
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName "WebDAVUsers"
    AuthType Digest
    AuthUserFile /etc/apache2/digestpwd
</Directory>


/users/MyUserName/Sites is the user level document root where I keep my website's documents.  MySubfolder is the directory I want to access via WebDAV.


Mike

SOLUTION
Avatar of urgoll
urgoll
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shacho
shacho

ASKER

Awesome!  OK - I can connect now, thanks very much to you.  I added the following line in order to activate password authentication:

Require User BlahBlahBlah

Alias /dav /users/MyUserName/Sites/MySubfolder
<Location /dav>
    Dav on
    Order allow,deny
    Allow from all
    AuthName "WebDAVUsers"
    AuthType Digest
    AuthUserFile /etc/apache2/digestpwd
    Require User BlahBlahBlah
</Location>

It does indeed ask me for a password, but it doesn't like the name and password I supplied.

The apache access.log says:
10.0.1.1 - - [03/Oct/2008:08:22:53 +0900] "PROPFIND /dav HTTP/1.1" 401 401

This is what I used to create the password file:
htdigest -c /etc/apache2/digestpwd WebDAVUsers BlahBlahBlah

I guessed with the 'realm' field entry of "WebDAVUsers".  I'm not sure what it's for.


Mike
 
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shacho

ASKER

I will try again when I get home tonight.  In the mean time:

>I recommend removing them from the <Directory> section.
Understood.

>If you could provide the client name and version you're using, it would be helpful.
I tried two clients, Mac OS X Finder (CMD-K) and Microsoft Windows Explorer.  Both (I believe) are supposed to work with digest authentication.  Both work with no authentication.  I have not tried a web browser yet.

Mike

Avatar of shacho

ASKER

Getting closer.  Here is a list of what I can and cannot currently do:

No Authentication
Finder in OS X -> Yes
Explorer in XP -> Yes

Basic Authentication
Finder in OS X -> Yes
Explorer in XP -> Yes

Digest Authentication
Finder in OS X -> Yes
Explorer in XP -> NO

However - on testing I see that I cannot write to the drive; I can only see its contents.  By adding Options Indexes, I was able to access the volume through a web browser.  Oddly, though, no contents appeared in the folder when viewed this way.

I guess I should start by working out how to become able to write to the folder with no authentication first.  Could this be a directory permissions issue.  Here is my current conf entry:

DavLockDB /var/run/apache2/DavLock
 
Alias /dav "/users/UserName/Sites/MySubfolder"
<Location /dav>
    Options Indexes
    Dav on
    Order allow,deny
    Allow from all
#    AuthName "WebDAVUsers"
#    AuthType Basic
#    AuthUserFile /etc/apache2/basicpwd
#    AuthType Digest
#    AuthUserFile /etc/apache2/digestpwd
#    Require User BlahBlahBlah
</Location>

Here is the error reported in the log when I tried to add a folder through the WebDAV interface:

The locks could not be queried for verification against a possible "If:" header.  [500, #0]
Could not open the lock database.  [500, #400]
(2)No such file or directory: Could not open property database.  [500, #1]



Mike

Avatar of shacho

ASKER

I realized that I hadn't set up the DavLock directory yet.  So I created it and reconfigured httpd.conf.  Here are the steps I took to get there:

[TERMINAL]
mkdir /etc/apache2/DavLock
chown www:www DavLock

[HTTPD.CONF]
DavLockDB /etc/apache2/DavLock

I still cannot write to the folder.  The error message in the log is essentially the same:
The locks could not be queried for verification against a possible "If:" header.  [500, #0]
Could not open the lock database.  [500, #400]
(13)Permission denied: Could not open property database.  [500, #1]

Mike


ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shacho

ASKER

Excellent!  Last hurdle.  Everything works fine for OS X.  But, I cannot connect using basic or digest authentication from XP (no authentication does work).  If I try to connect via Mozilla from XP, I can authenticate and see the directory, but I can't see any contents.  How can I make this work?  

Mike
Avatar of shacho

ASKER

Don't know if this is relevant but currently the contents of /var/apache2 are
DavLock.dir
DavLock.pag

Mike

Avatar of shacho

ASKER

Also - this is what access.log when I try to connect from XP:

"OPTIONS / HTTP/1.1" 200 -
"PROPFIND /dav HTTP/1.1" 401 401
"PROPFIND /dav HTTP/1.1" 401 401
"PROPFIND /dav HTTP/1.1" 401 401

Mike

Avatar of shacho

ASKER

Ah!  Got it!!  

From: http://blog.pclark.net/2005/03/fun-with-windows-xp-and-webdav.html

"The secret is to add a port number to the URL"
Use: http://my.site.com:80/mydirectory
NOT: http://my.site.com/mydirectory.

urgoll - you are a genius.  Thanks so much!

Cheers,

Mike




Actually, I'd say I'm an expert, not a genius. <grin>

I'm glad I was able to help!

Regards,
Avatar of shacho

ASKER

Next step is to get my other XP machine to connect.  Just added a question here:
https://www.experts-exchange.com/questions/23789292/Can't-Connect-to-WebDAV-Server-from-Windows-XP-Proxy-Issue.html
Please have a look if you can.

Cheers,

Mike