nginx + SabreDAV: Error 405 when accessing location via WebDAV, SabreDAV web interface works without problems

Francis Daly francis at daoine.org
Sat Mar 14 10:08:20 UTC 2015


On Fri, Mar 13, 2015 at 01:23:12PM +0100, Sebastian Schwaiger wrote:

Hi there,

> I'm trying to set up a WebDAV server using SabreDAV.

I don't see an obvious sample configuration for this for nginx,
but the sabredav docs do give a sample configuration for apache at
http://sabre.io/dav/webservers/, which seems to indicate that *all*
requests should be handled by sabredav; so whatever web server is used
is really just there to let sabredav do its work.

That is not what the configuration you show here does; so I suspect there
may need to be some more discussion about what exactly you want nginx
to do.

I would expect that for nginx, if every request that starts with "/s/"
should be passed to the fastcgi server to be processed by the file
/opt/sabredav/server.php, then all the configuration you need is

  server {
    location ^~ /s/ {
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME /opt/sabredav/server.php;
      fastcgi_pass unix:/var/run/php5-fpm.sock;
    }
  }

That will let requests that do not start with /s/ be served from the
filesystem at /usr/local/nginx/html, or whatever your configured root is.

>                                location /TENANT_ID/webdav/ {
> 
>                                                try_files $uri $uri/
> /TENANT_ID/webdav/index.php?$1;

$1 there probably does not have what you want.

And the try_files there will probably be what leads to the 405 that you see...

> 2015/03/13 12:06:44 [debug] 111#0: *513 http request line: "PROPFIND
> /TENANT_ID/webdav/ HTTP/1.0"

...because the request is for /TENANT_ID/webdav/, which refers to a
directory that exists, and the nginx serve-from-the-filesystem handler
does not "do" PROPFIND.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list