Nginx fastcgi latest 6

Hello friends. I am newbie. I decided to build a cloud in the enterprise, Kubuntu installed on the server, with raised nginx and mysql. Sefile established and set up everything. Everything works, but does not work with the browser download. Config configured as stated in the instructions, everything works through fast cgi. What could be the problem? Config:
`server {
listen 80;
server_name site;

proxy_set_header X-Forwarded-For $remote_addr;

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   REMOTE_ADDR         $remote_addr;

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

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;
}

location /media {
    root /home/lange/seafile-server-latest/seahub;
}

}`

Lines added:
FILE_SERVER_ROOT = ‘http://seafile.example.com/seafhttp
SERVICE_URL = http://seafile.example.com

The latest version 6.

Thanks from Russia

Please use Chrome or Firefox’s debug mode to check the detailed error message.

Assuming you added the lines to the correct files:

seahub_settings.py FILE_SERVER_ROOT = ‘https://your-dyndns-address/seafhttp
ccnet.conf: SERVICE_URL = https://your-dyndns-address

then the issue might be that you are not using https but http in your URLs. Please change this in your URLs before you provide the debug error messages, which @daniel.pan asked for.

I set everything according to the instruction. When downloading the file jumps out Bad access token. I don’t want to use https the protocol.

seahub_settings.py FILE_SERVER_ROOT = ‘https://your-dyndns-address/seafhttp
ccnet.conf: SERVICE_URL = https://your-dyndns-address

I added these lines as it is told in the instruction.
What else it is possible to look at and how to correct these errors?

as the seafile-developer daniel,pan said: look for browsers debug mode or so to support him helping you. Searching google for debugmode could help :confused:

How to use debugging Chromium?

The most interesting, at transition/seafhttp/the error of 500 nginx jumps out.

*26 connect() failed (111: Connection refused) while connecting to upstream, client: 195.226.209.148,$
2016/08/31 15:02:34 [error] 31913#31913:

When downloading a file via the web, a message appears:Bad access token

if you don’t post any logs or debug info, then please post at least your config files (of course mask sensitive data):

/etc/nginx/sites-available/seafile.conf
/etc/nginx/nginx.conf
/seafile-installdir/seafile/conf/ccnet.conf
/seafile-installdir/seafile/conf/seahub_settings.py

what does nginx output if you ssh: nginx -t ?

nginx -t

seafile.conf

  1. `server {
    listen 80;
    server_name site.ru;

    proxy_set_header X-Forwarded-For $remote_addr;

    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   REMOTE_ADDR         $remote_addr;
    
     access_log      /var/log/nginx/seahub.access.log;
     error_log       /var/log/nginx/seahub.error.log;
     fastcgi_read_timeout 36000;
    

    }

    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;
    }

    location /media {
    root /home/lange/seafile-server-latest/seahub;
    }
    }`

nginx.conf
2)`user www-data;
worker_processes 2;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log crit;

events {
worker_connections 768;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

    access_log off;
    
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

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

    gzip on;
    gzip_disable "msie6";

    gzip_vary on; # Разрешить выдавать в ответе строку заголовка "Vary: Accept-Encoding"
    gzip_proxied any; # Разрешить сжатие для всех проксированных запросов
    gzip_comp_level 4; # Степень сжатия (от 1 до 9 цифра больше увеличивает степень сжатия и увеличивает нагрузку на ЦПУ)
    gzip_buffers 16 8k; # Размер буферов, в которые будет сжиматься ответ
    gzip_http_version 1.1; # Устанавливает минимальную HTTP-версию запроса для сжатия ответа
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    #include /etc/nginx/conf.d/*.conf; # Если папка conf.d пустая, то можно закомментировать
    include /etc/nginx/sites-enabled/*;

}`

ccnet.conf
3)`[General]
USER_NAME = opencloud
ID =
NAME = opencloud
SERVICE_URL = http://site.ru/

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST =
PORT =
USER =
PASSWD =
DB = ccnet-db
CONNECTION_CHARSET = utf8`

seahub_settings.py
4) SECRET_KEY = "

FILE_SERVER_ROOT = 'http://site.ru/seafhttp'

DATABASES = {
    'default': {
        'ENGINE': 
        'NAME': 
        'USER': 
        'PASSWORD': 
        'HOST': 
        'PORT': 
    }
}

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': 
    }
}

EMAIL_USE_TLS = True
EMAIL_HOST = 
EMAIL_HOST_USER = 
EMAIL_HOST_PASSWORD = 
EMAIL_PORT = 
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

DEBUG = True

I wrote above. I do not know my answer is displayed or not.

With the download link for any error pops up:Bad access token

http://site.ru/seafhttp/

you are using nginx. so you have to make an HTTPS address and not a HTTP! I told you this already in my first answer: Nginx fastcgi latest 6

Change everything in your files to https like I already said and it should work :wink:

EDIT
also it appears that you use the wrong manual page, use this here instead, or are you not intending to use httpS? http://manual.seafile.com/deploy/https_with_nginx.html

1 Like

Many thanks, everything works! But I don’t want to use https. It is possible to do without https?

aaah okay haha :smile:

Yes I think so. If you follow the manual it should work. I assume in your case it should be a port forwarding issue. You’d have to find out which ports you need to forward in your router for getting it to work.

If using https in nginx with https it is enough to forward port 443 to your server. I think (but I’m not sure, because lacking of experience) that you need to open/forward at least 2 specific ports for non-HTTPS.

it could be necessary to open ports 8000 and 8001 and perhaps 8082

and try the urls: http://site.ru:8000 or http://site.ru:8001 … I’m not sure about this. Perhaps you have to add those ports also to FILE_SERVER_ROOT and SERVICE_URL. You will have to google it, if nobody knows it better here. Sorry for not able to help you :confused:

Thank you very much for your help and responsiveness. You have very much helped out!:wink:

please post your solution if you’ve lost the problem. For the community.

I have decided to remain on https. Many thanks to you!

1 Like