Tutorial: Seafdav with WSGI behind Nginx

Would it be possible to replace FastCGI for Seafdav behind nginx?
If so, how should the nginx configuration look like?

Just checked the status of my seafile service on Linux and it contains the following line:
“─28612 /usr/bin/python2.7 -m wsgidav.server.run_server runfcgi --log-file /Speicher/logs/seafdav.log --pid /Speicher…”.
Does this mean that the webdav server within seafile uses wsgi natively and enables additional fcgi just to allow communication through nginx?
Is there a way to change the nginx script for webdav to run with wsgi directly?
Thanks a lot,

Ok, I guess I figured it out myself.
In case someone else wants to use WSGI for webdav as well, set fastcgi = false in seafdav.conf and change your nginx script to this:

location /seafdav {
     proxy_set_header   Host $host;
     proxy_set_header   X-Real-IP $remote_addr;
     proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header   X-Forwarded-Host $server_name;
    client_max_body_size 0;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
   send_timeout  36000s;
    # This option is only available for Nginx >= 1.8.0. See more details below.
    proxy_request_buffering off;
    access_log      /var/log/nginx/seafdav.access.log;
    error_log       /var/log/nginx/seafdav.error.log;

Seems to work perfectly.
Kind regards,
P.S. Is there something that I should add or remove from the current configuration?


So its just to change the config file at nginx to this that you wrote above?

Why did the devs say that webdav does only support fastcgi?

Either there is a reason or they don’t know what they talk about. :-/

I don’t think there is a reason.
It seems that Seafile uses a wsgi webdav server, so why should it worrk better with fastcgi?!
Perhaps the manual needs some update though…

Yes, this and changing the line in seafdav.conf to fastcgi = false.

This is just what I was thinking. The devs say something and implement something but it’s not reflected in the manual at all or even false information is given to the users. I don’t get it… why switch Seahub to WSGI and ignore WebDAV leaving it at fastcgi, even when we asked for it?

@daniel.pan @xiez
Someone explain that to us please.



it also works on Apache :

Webdav works fine while fastcgi mode is set to false and the Apache vhost use Proxypass


  RewriteCond %{HTTP:Authorization} (.+)
  RewriteRule ^(/davf.*)$ /seafdav.fcgi$1 [QSA,L,e=HTTP_AUTHORIZATION:%1]
  RewriteRule ^(/davf.*)$ /seafdav.fcgi$1 [QSA,L]

to this

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
ProxyPass /davf
ProxyPassReverse /davf

Why I cannot login from local intranet ?
It pop up login windows, but cannot authenticate

2021-02-16 19:36:30.827 - <3069820928> wsgidav.http_authenticator  WARNING :  Authentication (basic) failed for user 'xxx@gmail.com', realm 'Seafile Authentication'.
2021-02-16 19:36:30.828 - <3069820928> wsgidav.wsgidav_app         INFO    : - (anonymous) - [2021-02-17 03:36:30] "GET " elap=0.147sec -> 401 Not Authorized