Seafile: File-Upload not working: 502 - Bad Gateway

2,176 views
Skip to first unread message

Matthias Roeske

unread,
Oct 10, 2014, 2:19:39 AM10/10/14
to sea...@googlegroups.com
Hey there,

I'm using Seafile with NGINX and SSL on a GNU/Linux Debian 7 root-Server.
The frontend is working fine, but 'm not able to upload any files.
At first, the upload starts, till 100%, says "Saving..." and then, "Bad Gateway".

But, I have to say:
+++++++++++++++++
I'm running a complete "froxlor"-ISP-environment with Apache on port 80 and 443 and PHP5-FPM on this root-Server, too.
So I said to NGINX, to use port 88 (HTTP) and 444 (HTTPS) insted of the default ports, not to collide with the Apache.
+++++++++++++++++

In seahub_settings.py and ccnet/ccnet.conf I've added the "special" HTTPS port 444 to the URLs.

All the /var/log/nginx/seafile and seahub logs are fine, no errors or warnings.

But, the /var/log/nginx/error.log says:
"connect() failed (111: Connection refused) while connecting to upstream"

I've even added an /etc/nginx/pool.d/www.conf with the
"listen = 127.0.0.1:9000"

Parameter, but it's still not working.

Any suggestions will be appreciated!

Thanks in advance and best regards,
Matthias Roeske


JiaQiang Xu

unread,
Oct 10, 2014, 8:59:34 AM10/10/14
to sea...@googlegroups.com
For large files, it takes long time to save it to Seafile. So Nginx may time out the upstream server. You should set the timeout to a longer time.

Matthias Roeske

unread,
Oct 10, 2014, 1:08:25 PM10/10/14
to sea...@googlegroups.com
Hey JiaQiang Xu,

thanks for your answer, the file I've uploaded is only 130KB an another only 900KB big... :-(

Shuai Lin

unread,
Oct 10, 2014, 1:11:06 PM10/10/14
to sea...@googlegroups.com
Can you show us:

- ccnet/ccnet.conf
- seafile-data/seafile.conf
- seahub_settings.py

And the part of your nginx config related to seafile server.
 

On Sat, Oct 11, 2014 at 1:08 AM, Matthias Roeske <matthia...@googlemail.com> wrote:
Hey JiaQiang Xu,

thanks for your answer, the file I've uploaded is only 130KB an another only 900KB big... :-(

--
You received this message because you are subscribed to the Google Groups "seafile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seafile+u...@googlegroups.com.
To post to this group, send email to sea...@googlegroups.com.
Visit this group at http://groups.google.com/group/seafile.
For more options, visit https://groups.google.com/d/optout.

Matthias Roeske

unread,
Oct 10, 2014, 2:58:33 PM10/10/14
to sea...@googlegroups.com
Hello Shuai Lin,

yes, for sure:

seahub_settings.py:
+++++++++++++++++++++++++++++++

SECRET_KEY = "CENSORED"

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'seafile',
        'PASSWORD': 'CENSORED',
        'HOST': '127.0.0.1',
        'PORT': '3306',
        'OPTIONS': {
            'init_command': 'SET storage_engine=INNODB',
        }
    }
}

HTTP_SERVER_ROOT = "https://www.domain.de:444/seafhttp"



ccnet/ccnet.conf:
+++++++++++++++++++++++++++++++
[General]
USER_NAME = CloudABC
ID = dd08a140a5cdbb25db4824496ae8a6eba6f43c90
NAME = CloudABC
SERVICE_URL = https://www.domain.de

[Network]
PORT = 10001

[Client]
PORT = 13418

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = CENSORED
DB = ccnet-db
CONNECTION_CHARSET = utf8



seafile-data/seafile.conf:
+++++++++++++++++++++++++++++++
[network]
port = 12001

[httpserver]
port = 8082
https=true

[fileserver]
port = 8082

[database]
type = mysql
host = 127.0.0.1
port = 3306
user = seafile
password = CENSORED
db_name = seafile-db
connection_charset = utf8

Matthias Roeske

unread,
Oct 10, 2014, 3:05:31 PM10/10/14
to sea...@googlegroups.com
/etc/nginx/sites-enabled/seafile

server {
      listen       88;
      server_name  www.domain.de;
      rewrite ^ https://$server_name$request_uri? permanent;    # force redirect http to https
  }
  server {
      listen 444;
      ssl on;
      ssl_certificate /var/customers/webs/webcustomer/cloud/servercert.pem;            # path to your cacert.pem
      ssl_certificate_key /var/customers/webs/webcustomer/cloud/serverkey.pem;             # path to your privkey.pem
      server_name www.domain.de;
      location / {
          fastcgi_pass    127.0.0.1:8000;
          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               on;
          fastcgi_param   HTTP_SCHEME         https;
          access_log      /var/log/nginx/seahub.access.log;
          error_log       /var/log/nginx/seahub.error.log;
      }
      location /seafhttp {
          rewrite ^/seafhttp(.*)$ $1 break;
          proxy_pass http://127.0.0.1:8082;
          client_max_body_size 0;
        }
location ~ .php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    include fastcgi_params;
    }
      location /media {
          root /var/customers/webs/webcustomer/cloud/seafile-server-latest/seahub;
      }
  }

Shuai Lin

unread,
Oct 10, 2014, 10:07:26 PM10/10/14
to sea...@googlegroups.com
Your config looks fine to me. Can you:

1. show me the content of the log files "logs/http.log" and "logs/controller.log"

2. Run this command and show me the output:   "netstat -nltp | grep 8082"

Matthias Roeske

unread,
Oct 16, 2014, 2:03:19 PM10/16/14
to sea...@googlegroups.com
Hello Shua Lin, thanks for your help, this is the LOG:

2014/10/16 19:57:32 [error] 30994#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 82.83.154.95, server: www.domain.de, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:8000", host: "www.domain.de:444"

If i run: "netstat -nltp | grep 8082" there is no TCP-Daemon Listening on 8082... is this the error?

The "seaf-server" is listening on TCP 12001

Thanks for your help! :-)

Matthias Roeske

unread,
Oct 22, 2014, 9:52:18 AM10/22/14
to sea...@googlegroups.com

Any further ideas? :-/

Matthias Roeske

unread,
Nov 27, 2014, 12:56:28 PM11/27/14
to sea...@googlegroups.com
Hey there,

I've updated to Seafile 4.0.0 (64-Bit) BETA, now it works like a charm - with the same settings as posted above. Anyway. It Works!
Thanks for your help!

Best regards
Matthias
Reply all
Reply to author
Forward
0 new messages