Symptoms
-
Seafile WebDAV at https://example.com/seafdav returns error 504 on Plesk server
-
Seafile version 7.1.* is installed on the server.
-
The following error can be found on
/var/www/vhosts/example.com/logs/proxy_error_log
with a reference to FastCGI being used:[error] 23456#0: *516 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 195.111.222.3, server: hostname.tld, request: "GET /seafdav HTTP/1.1", upstream: "fastcgi://127.0.0.1:8002", host: "example.com"
-
Configuration file for seafdav at
/var/www/vhost/example.com/seafile/conf/seafdav.conf
has FastCGI set to false:[WEBDAV]
enabled = true
port = 8002
fastcgi = false
share_name = /
Cause
After Seafile version 7.1.x, seafdav no longer supports FastCGI, only WSGI. This is seafile bug which will be fixed in the next release. Proxy Configuration needs to be set on the Nginx configuration file for the affected domains manually. For more information please refer to Seafile documentation.
Resolution
-
Connect to the server via SSH
-
Create a backup of the current Nginx configuration file for the domain:
# cp /var/www/vhosts/system/example.com/conf/nginx.conf{,.bak}
-
Edit the Nginx configuration file that corresponds to the affected domain. Vi editor may be used:
# vi /var/www/vhosts/system/example.com/conf/nginx.conf
Replace the following FastCGI parameters entirely:
location ~* ^/seafdav {
fastcgi_pass 127.0.0.1:8002;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
.
client_max_body_size 0;
}With these Proxy parameters:
location ~* ^/seafdav {
proxy_pass http://127.0.0.1:8002;
proxy_set_header Host $host:$server_port;
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;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1200s;
client_max_body_size 0;
}Note: Make sure to use the same port number found at
/var/www/vhost/example.com/seafile/seafdav.conf
. In this example, we are using port "8002". -
Edit the seafdav configuration file to match the following, leaving the pre-configured port as is:
# vi /var/www/vhost/example.com/seafile/seafdav.conf
CONFIG_TEXT:
[WEBDAV]
enabled = true
port = 8002
fastcgi = false
share_name = /seafdav -
Restart Nginx and Seafile services. The name for the Seafile service will depend on the port configured for seafdav. In this example seafdav port is 8002, so the seafile service port will be 8000:
# systemctl restart nginx seafile@8000