dav icon indicating copy to clipboard operation
dav copied to clipboard

Using default 'Getting Started' config, with server.php in the webroot, sabre fails while searching for 'public/server.php'

Open winteriscariot opened this issue 1 year ago • 1 comments

I'm setting up a webdav server using sabre and i've configured a minimal server using the config recommended here:

https://sabre.io/dav/gettingstarted/

since i'm putting server.php in the webroot, I've commented out the 'setBaseUri' command

however, when going to https://dav.mydomain.com/server.php, I get the following error:

<d:error>
<s:sabredav-version>3.2.2</s:sabredav-version>
<s:exception>Sabre\DAV\Exception\NotFound</s:exception>
<s:message>
File with name public/server.php could not be located
</s:message>
</d:error>

It is unclear to my why Sabre is looking in the 'public' directory for a server.php file; none of the documentation indicates that i need to put that php file in that directory.

I'm using nginx and here is my virtual host for the sabre service:

server {
    listen 80;
    listen [::]:80;
    server_name sub.mydomain.com;

    return 301 https://$server_name;
}

server {
    listen 443 ssl;
    server_name sub.mydomain.com;

    dav_methods PUT DELETE MKCOL COPY MOVE;
    dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK;
    dav_access      user:rw group:rw all:rw;
    
    ssl_certificate /etc/letsencrypt/live/sub.mydomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/sub.mydomain.com/privkey.pem;
        
    root /mnt/storage/http/sabre;

    create_full_put_path  on;
    client_body_temp_path /tmp/;

    include /etc/nginx/php_fastcgi.conf;    
    access_log      /var/log/nginx/sabre.access.log;
    error_log       /var/log/nginx/sabre.error.log;
}

I've gone over the documentation a few times and they all seem to assume I'll be putting it in a sub directory (mydomain.com/dav or whatever) yet still say "if you're not putting it in the webroot" but in this case I am putting it in the webroot.

What am i missing here?

edit: i have also tried with the 'minimal.php' that is included with the examples.

if i put this all into sub.domain.com/dav and update the baseURI option, it does appear to work. but that's not what i'm trying to achieve here.

winteriscariot avatar Aug 06 '22 16:08 winteriscariot

@winteriscariot - I may be completely wrong, but maybe the issue is that you haven't configured nginx properly?

You don't seem to be mentioning the index property. Or passing php files to fastcgi for processing

Here's an example that I found for installing sabre/dav with nginx (it's not super comprehensive - but it's a start - refer to the docs link for the rest) -

https://gist.github.com/0xIslamTaha/da09b759819a0f02766edd4c698a8818

BRAiNCHiLD95 avatar Aug 22 '22 07:08 BRAiNCHiLD95