Nginx Reverse Proxy

Have upgraded to Seafile Server 6.2.1 and read the information that recommends moving away from fastcgi to WSGI.
Changed my nginx conf from the previous fast cgi one to WSGI but nothing works.

I have switched back to the fastcgi conf and all is okay again.

One thing I haven’t been doing is starting seahub with the -fastcgi option.

Here is my new conf, any reason this isn’t working? so i need to install a different nginx module?

server {
listen 443 http2;
ssl on;
ssl_certificate /etc/ssl/cacert.pem;
ssl_certificate_key /etc/ssl/privkey.pem;
server_name xxxx.com;
proxy_set_header X-Forwarded-For $remote_addr;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    server_tokens off;
location / {
    proxy_pass         http://127.0.0.1:8000;
    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;
    proxy_read_timeout  1200s;
    access_log      /var/log/nginx/seahub.access.log;
    error_log       /var/log/nginx/seahub.error.log;
    client_max_body_size 0;
}
location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass http://127.0.0.1:8082;
    client_max_body_size 0;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    send_timeout  36000s;
    proxy_request_buffering off;
}
1 Like

Also when you use fastcgi you don’t run with seahub.sh start-fastcgi and it works?

yes thats correct

thanks for the feedback I will test it on rpi.

another clarification, only seahub doesn’t work (start without failure) or seafile doesn’t work as well (start without failure)? Both or only seahub doesn’t start?

I’m having the same issue since uppgrading Seafile server to 6.2.1 on a Raspberry Pi B+.
The old config used to work with the previous version but now I’d like to reconfigure my setup to use WSGI.

Old nginx config (used to start seahub with fast-cgi):

New nginx config (starting without fast-cgi, to my understanding):

Edit:
Sorry for the messed up formatting. Not sure how to fix it. To be clear: the Seafile clients (one desktop and one Android) seem to connect and sync, but now the libraries don’t show up; they just keep loading indefinitely. When trying to access Seafile through the browser, it times out.

glad to see I’m not the only one with this issue. Is there any reasoning behind the switch from fastcgi to WSGI? Improved performance or more reliable?

Yes, this is the case. It is mentioned in the announcement of the 6.2.0 release and in the manual. Gunicorn was native delivered with Seafile for a long time ago and is nice to see him back again. Here more Infos regarding gunicorn and wsgi here and here. That should be considered an improvment, not a regresion.

Having same problem here under Ubuntu 16/Nginx on Seafile CE 6.1.2.

Command/script ‘seahub.sh start’ appears to work in terminal but ‘502 Bad Gateway’ in browser. Seafile Client works.

Command seafile-start.sh still works but it says that it is loading using fastcgi. Web interface OK. Hmm…

Anybody got a clue on how to disentangle from fastcgi?

-Thanks!

@DWhell2 @Captain_Rage

we had the same issue in over here in this thread when moving to wsgi --> link
The thread is in german, but basically the fix was to add your port to the proxy_set_header in your ngingx coniguration

  location / {
         proxy_pass         http://127.0.0.1:8000;
         proxy_set_header   Host $host:8001;                  <------ YOUR PORT HERE
         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 https;
         proxy_read_timeout  1200s;

         # used for view/edit office file via Office Online Server
         client_max_body_size 0;

         access_log      /var/log/nginx/seahub.access.log;
         error_log       /var/log/nginx/seahub.error.log;
    }