SabreDav and Nginx configuration

785 views
Skip to first unread message

WG

unread,
Dec 22, 2016, 6:59:48 PM12/22/16
to SabreDAV Discussion
Hi there!

Thanks for all the work, I used sabredav multiple times on apache servers and it always worked great. Now I trying to set it up with ubuntu and nginx, but with no luck. I'm having a hard time routing the request to my-domain.com/calendarserver.php/

Without the trailing slash I get an error:

<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
   
<s:sabredav-version>3.1.3</s:sabredav-version>
   
<s:exception>Sabre\DAV\Exception\NotFound</s:exception>
   
<s:message>File not found: calendarserver.php in 'root'</s:message>
</d:error>


But with the trailing slash I get an Access Denied error, because my .php/ is not a supported extension. Do I need to add this extension in my php config? Here is the error:

[error] 18564#18564: *290 FastCGI sent in stderr: "Access to the script '/home/my-domain.com/public/calendarserver.php/' has been denied (see security.limit_extensions)" while reading response header from upstream, client: xx.xx.xx.xx, server: my-domain.com, request: "GET /calendarserver.php/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "my-domain.com"

A lot of people should have installed sabredav with nginx, right? I must be doing something completly wrong. Here is my location rule:

location ^~ /calendarserver.php/ {
        fastcgi_split_path_info
^(.+\.php)(/.+)$;
        fastcgi_pass unix
:/var/run/php/php7.1-fpm.sock;
        include fastcgi_params
;
   
}

The reason I specifically match this, is that all other php requests are handled by a framework. But all other location rules are commented out for testing. So there is no other routing. I would even move the whole framework, which serves an api, to another subdomain, but I would still need to configure nginx...

Any ideas? Thanks!!

Evert Pot

unread,
Dec 27, 2016, 7:34:49 PM12/27/16
to SabreDAV Discussion
Hi WG,

sabre/dav relies on a feature often called "PATH_INFO". The baikal documentation has some sample nginx configuration that also applies to sabre/dav:

http://sabre.io/baikal/install/

Using those settings should fix this problem.

Evert
 

WG

unread,
Dec 28, 2016, 3:36:00 AM12/28/16
to SabreDAV Discussion
Hi Evert!

Thanks for your reply. I used the baikal config, restarted nginx and now the calendarserver.php/ is read. However, now I get the :

File not found: calendarserver.php in 'root'


error. But the base uri should be fine. I'm running on a subdomain (kalender.my-domain.de), but there is no subdirectory. I'm running the server.php from the directory, which is the root in the nginx configuration. And I can even hit the server.php and everything works fine. I can even upload files. It's just the calendarserver.php/ that's throwing an error.

If I try to list the plugins from the server.php there is also an error:

Requested uri (/server.php?sabreAction=plugins) is out of base uri (server.php/)

But the base uri is defaulting to 'server.php' in my server.php. Without the trailing slash.

Any ideas? Thank you so much for your help.

Evert Pot

unread,
Jan 2, 2017, 1:31:32 PM1/2/17
to SabreDAV Discussion


On Wednesday, December 28, 2016 at 3:36:00 AM UTC-5, WG wrote:
Hi Evert!

Thanks for your reply. I used the baikal config, restarted nginx and now the calendarserver.php/ is read. However, now I get the :

File not found: calendarserver.php in 'root'


error. But the base uri should be fine. I'm running on a subdomain (kalender.my-domain.de), but there is no subdirectory. I'm running the server.php from the directory, which is the root in the nginx configuration. And I can even hit the server.php and everything works fine. I can even upload files. It's just the calendarserver.php/ that's throwing an error.

If I try to list the plugins from the server.php there is also an error:

Requested uri (/server.php?sabreAction=plugins) is out of base uri (server.php/)

But the base uri is defaulting to 'server.php' in my server.php. Without the trailing slash.

Any ideas? Thank you so much for your help.

In this particular case it's the preceeding slash that you're missing. For the error that you just got, the base uri should be : /server.php/

Evert

WG

unread,
Jan 2, 2017, 2:16:16 PM1/2/17
to SabreDAV Discussion
Hi Evert!

Thank you so much for your help. Settings the baseUri to '/server.php/' in server.php didn't help. I still got the same error. But setting the baseUri to '/calendarserver.php/' in calendarserver.php did the job.

Evert Pot

unread,
Jan 2, 2017, 2:49:16 PM1/2/17
to sabredav...@googlegroups.com
On 2017-01-02 02:16 PM, WG wrote:
> Hi Evert!
>
> Thank you so much for your help. Settings the baseUri to '/server.php/'
> in server.php didn't help. I still got the same error. But setting the
> baseUri to '/calendarserver.php/' in calendarserver.php did the job.

Only one of those two files should exist. They both likely have the same
purpose, so I'd recommend deleting the one you're not using.

Evert
Reply all
Reply to author
Forward
0 new messages