Can't upload via browser - 'Can not connect to server' - Clients work fine (NGIX+HTTPS)

2,448 views
Skip to first unread message

Brandon Harris

unread,
Aug 14, 2014, 2:16:13 PM8/14/14
to sea...@googlegroups.com
Uploading a file via the client (windows and mac tested) works fine. When using the browser (Chrome) I get the following error ' Error: can not connect to the server'

  • Ubuntu 14 LTS - nginx web server, redirecting http to https. 
  • Brand new VPS, no space/quota issues
  • Files being tested are all under 1MB in size.


seafile.conf
[network]
port = 12001

[fileserver]
host = 127.0.0.1 --added this in trying to fix the issue
port = 8082

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

ccnet.conf
[General]
USER_NAME = vaughn
ID = f7b87bd597be78c1407072e602c3a701bbe22129
NAME = vaughn
SERVICE_URL = https://[redacted]/seafile

[Network]
PORT = 10001

[Client]
PORT = 13418

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

seahub_settings.py
SECRET_KEY = [redacted]
SERVE_STATIC=False
MEDIA_URL='/seafmedia/'
SITE_ROOT= '/seafile/'
FILE_SERVER_ROOT= 'https://[redacted]/seafhttp'
HTTP_SERVER_ROOT='https://[redacted]/seafhttp' --added this to test resolving the issue

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

/etc/nginx/sites-available/seafile
    server {
        listen       80;
        server_name [redacted];
        rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
    }

server {
    listen 443;
    server_name [redacted];
    ssl on;
        ssl_certificate /etc/nginx/certs/cacert.pem;    # path to your cacert.pem
        ssl_certificate_key /etc/nginx/certs/privkey.pem;    # path to your privkey.pem
    location /seafile {
   

        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; # enable this line only if https is used
        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 /seafmedia {
        rewrite ^/seafmedia(.*)$ /media$1 break;
        root /home/brandon/seafile/seafile-server-latest/seahub;
    }
}


Brandon Harris

unread,
Aug 14, 2014, 2:19:41 PM8/14/14
to sea...@googlegroups.com
brandon@vaughn:~/seafile/seafile-data$ sudo netstat --listen
[sudo] password for brandon:


Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 localhost:6010          *:*                     LISTEN
tcp        0      0 localhost:6011          *:*                     LISTEN
tcp        0      0 *:https                 *:*                     LISTEN
tcp        0      0 localhost:8000          *:*                     LISTEN
tcp        0      0 *:12001                 *:*                     LISTEN
tcp        0      0 localhost:mysql         *:*                     LISTEN
tcp        0      0 *:http                  *:*                     LISTEN
tcp        0      0 *:10001                 *:*                     LISTEN
tcp        0      0 localhost:8082          *:*                     LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
tcp6       0      0 ip6-localhost:6010      [::]:*                  LISTEN
tcp6       0      0 [::]:32378              [::]:*                  LISTEN
tcp6       0      0 ip6-localhost:6011      [::]:*                  LISTEN
tcp6       0      0 [::]:http               [::]:*                  LISTEN
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     7429     /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     937613   /home/brandon/seafile/ccnet/ccnet.sock
unix  2      [ ACC ]     STREAM     LISTENING     9034     /var/run/mysqld/mysqld.sock
unix  2      [ ACC ]     SEQPACKET  LISTENING     7254     /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     6924     @/com/ubuntu/upstart
unix  2      [ ACC ]     STREAM     LISTENING     8832     /var/run/acpid.socket

Shuai Lin

unread,
Aug 14, 2014, 9:21:07 PM8/14/14
to sea...@googlegroups.com
Your config looks fine. When Chrome shows "Error: can not connect to the server",  can you open the chrome debug console (just press F12 in Chrome), and check the details of error message there?



--
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.

Brandon Harris

unread,
Aug 14, 2014, 9:25:08 PM8/14/14
to sea...@googlegroups.com
Thanks.. F12 on the mac didn't work, but I think this is the console output you wanted.. View/Developer/Dev Tools/Console

Failed to load resource: net::ERR_INSECURE_RESPONSE             https://[redacted]/seafhttp/upload-aj/011b6ef6


sounds like it might be an HTTPS config issue?

Shuai Lin

unread,
Aug 14, 2014, 9:29:48 PM8/14/14
to sea...@googlegroups.com
1. Are https://[redacted]/seafhttp/upload-aj/011b6ef6 and https://[redacted]/seafile using the same host?
2. Try to visit the page https://[redacted]/seafhttp, what does  the browser show?

Brandon Harris

unread,
Aug 14, 2014, 9:31:33 PM8/14/14
to sea...@googlegroups.com
1. Yep, same host.. all on a single VPS.
2. 500 Internal Server Error


On Thu Aug 14 20:29:46 2014, Shuai Lin wrote:
> 1. Are https://[redacted]/seafhttp/upload-aj/011b6ef6 and
> https://[redacted]/seafile using the same host?
> 2. Try to visit the page https://[redacted]/seafhttp, what does the
> browser show?
>
>
> On Fri, Aug 15, 2014 at 9:25 AM, Brandon Harris
> <brandon...@gmail.com <mailto:brandon...@gmail.com>> wrote:
>
> Thanks.. F12 on the mac didn't work, but I think this is the
> console output you wanted.. View/Developer/Dev Tools/Console
>
> |
> Failedto load resource:net::ERR_INSECURE_RESPONSE
> https://[redacted]/seafhttp/upload-aj/011b6ef6
> |
>
>
> sounds like it might be an HTTPS config issue?
>
>
> On Thursday, August 14, 2014 8:21:07 PM UTC-5, Shuai Lin wrote:
>
> Your config looks fine. When Chrome shows "Error: can not
> connect to the server", can you open the chrome debug console
> (just press F12 in Chrome), and check the details of error
> message there?
>
>
>
> On Fri, Aug 15, 2014 at 2:16 AM, Brandon Harris
> <brandon...@gmail.com> wrote:
>
> Uploading a file via the client (windows and mac tested)
> works fine. When using the browser (Chrome) I get the
> following error ' Error: can not connect to the server'
>
> * Ubuntu 14 LTS - nginx web server, redirecting http to
> https.
> * Brand new VPS, no space/quota issues
> * Files being tested are all under 1MB in size.
>
>
>
> *seafile.conf*
> [network]
> port = 12001
>
> [fileserver]
> host = 127.0.0.1--added this in trying to fix the issue
> port = 8082
>
> [database]
> type = mysql
> host = 127.0.0.1
> port = 3306
> user = root
> password = [x]
> db_name = seafile-db
> connection_charset = utf8
>
> *ccnet.conf*
> [General]
> USER_NAME = vaughn
> ID = f7b87bd597be78c1407072e602c3a7__01bbe22129
> NAME = vaughn
> SERVICE_URL = https://[redacted]/seafile
>
> [Network]
> PORT = 10001
>
> [Client]
> PORT = 13418
>
> [Database]
> ENGINE = mysql
> HOST = 127.0.0.1
> PORT = 3306
> USER = root
> PASSWD = [x]
> DB = ccnet-db
> CONNECTION_CHARSET = utf8
>
> *seahub_settings.py*
> SECRET_KEY = [redacted]
> SERVE_STATIC=False
> MEDIA_URL='/seafmedia/'
> SITE_ROOT= '/seafile/'
> FILE_SERVER_ROOT= 'https://[redacted]/seafhttp'
> HTTP_SERVER_ROOT='https://[__redacted]/seafhttp'--added
> this to test resolving the issue
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql',
> 'NAME': 'seahub-db',
> 'USER': 'root',
> 'PASSWORD': [x],
> 'HOST': '127.0.0.1',
> 'PORT': '3306',
> 'OPTIONS': {
> 'init_command': 'SET storage_engine=INNODB',
> }
> }
> }
>
> */etc/nginx/sites-available/__seafile*
> server {
> listen 80;
> server_name [redacted];
> rewrite ^ https://$http_host$request___uri?
> permanent; # force redirect http to https
> }
>
> server {
> listen 443;
> server_name [redacted];
> ssl on;
> ssl_certificate /etc/nginx/certs/cacert.pem; #
> path to your cacert.pem
> ssl_certificate_key /etc/nginx/certs/privkey.pem;
> # path to your privkey.pem
> location /seafile {
>
>
> fastcgi_pass 127.0.0.1:8000
> <http://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; # enable
> this line only if https is used
> 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 /seafmedia {
> rewrite ^/seafmedia(.*)$ /media$1 break;
> root
> /home/brandon/seafile/seafile-__server-latest/seahub;
> }
> }
>
>
> --
> 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
> <http://groups.google.com/group/seafile>.
> For more options, visit
> https://groups.google.com/d/__optout
> <https://groups.google.com/d/optout>.
>
>
> --
> 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
> <mailto:seafile+u...@googlegroups.com>.
> To post to this group, send email to sea...@googlegroups.com
> <mailto:sea...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/seafile.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "seafile" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/seafile/eZJb0YNN0E0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> seafile+u...@googlegroups.com
> <mailto:seafile+u...@googlegroups.com>.
> To post to this group, send email to sea...@googlegroups.com
> <mailto:sea...@googlegroups.com>.

Brandon Harris

unread,
Aug 14, 2014, 9:36:21 PM8/14/14
to sea...@googlegroups.com
Ah, going to http://[]/seafile/seafhttp gets me a Seafile 'private page', 'sorry this page cannot be found'.


Florian D

unread,
Aug 14, 2014, 9:38:57 PM8/14/14
to sea...@googlegroups.com

Brandon Harris

unread,
Aug 14, 2014, 9:45:16 PM8/14/14
to sea...@googlegroups.com
OK, so testing a bit, I managed to fix the upload problem, but now after the upload, I get "FILE NOT FOUND".

here's the F12 from Chrome - Failed to load resource: the server responded with a status of 404 (NOT FOUND) https://[x]/seafile/seafhttp/upload-aj/c437fab7

I modified the following lines in seahub_settings.py

FILE_SERVER_ROOT= 'https://[x]/seafile/seafhttp'
HTTP_SERVER_ROOT='https://[x]/seafile/seafhttp'


On Thu, Aug 14, 2014 at 8:31 PM, Brandon Harris <brandon...@gmail.com> wrote:

Brandon Harris

unread,
Aug 14, 2014, 10:02:57 PM8/14/14
to sea...@googlegroups.com
OK, resolved!

After I changed the seahub_settings.py lines, I modified the site file in nginx.

 location /seafile/seafhttp {
        rewrite ^/seafile/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
    }

That took care of it.

Thanks again for getting me started!
Reply all
Reply to author
Forward
0 new messages