Problems loading the seafile site for ngenix

version seafile 10. I don’t understand what the problem could be. The ngenix config was taken from the official website. The coolest thing is that the client on Windows and Android works fine, sometimes there are only problems with downloading files. and also before I started using ngenix. I still have the browser cache as I believe. and the page on one device worked fine on which I downloaded the seafile before ngenix. problems were discovered on another device and after clearing the cache.

log_format seafileformat '$http_x_forwarded_for $remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $upstream_response_time';


server {

    listen 800;

    server_name zomb;


    proxy_set_header X-Forwarded-For $remote_addr;

    location / {

         proxy_pass         http://127.0.0.1:8000;

         proxy_set_header   Host $http_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;


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

         client_max_body_size 0;


         access_log      /var/log/nginx/seahub.access.log seafileformat;

         error_log       /var/log/nginx/seahub.error.log;
         
         proxy_request_buffering off;
    }


    location /seafhttp {

        rewrite ^/seafhttp(.*)$ $1 break;

        proxy_pass http://127.0.0.1:8082;

        client_max_body_size 0;

        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;


        proxy_connect_timeout  36000s;

        proxy_read_timeout  36000s;

        proxy_send_timeout  36000s;


        send_timeout  36000s;


        access_log      /var/log/nginx/seafhttp.access.log seafileformat;

        error_log       /var/log/nginx/seafhttp.error.log;
        
        proxy_request_buffering off;
    }

    location /media {

        root /home/direkt/osnovahdd/cloud/seafile-server-latest;

    }

}


Please help me.

I’m assuming this is an NGINX instance running on your host machine and you are trying to reverse-proxy to Seafile running in docker, right?

In that case, you are duplicating too much stuff. The flow should actually be:

NGINX (host) → NGINX (seafile container) → Seahub

Something like this should work:

server {
    listen 800;
    server_name zomb;

    # set upstream location of seafile container
    # doing it this way means NGINX will still start even if seafile container is not running
    set $upstream_seafile http://127.0.0.1:8000;

    location / {
        client_max_body_size 0;

        proxy_set_header Host $http_host;
        proxy_set_header Forwarded "for=$remote_addr;proto=$scheme";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Connection "";

        proxy_http_version 1.1;
        proxy_pass $upstream_seafile;
    }
}

The advantage here is that you are just setting headers and letting the in-container NGINX do all the work. This configuration should work regardless of if the container is updated, so it saves you having to change things on upgrade.

In addition, you can easily add HTTPS to this configuration without having to load any certificates in the seafile container :slight_smile:

Let me know if this helps or if I totally misunderstood your question/set-up.

oh god thank you so much it helped me but I changed the config a little.

server {
    listen 800;
    server_name zomb;

    # set upstream location of seafile container
    # doing it this way means NGINX will still start even if seafile container is not running
    set $upstream_seafile http://127.0.0.1:8000;

    location / {
        client_max_body_size 0;

        proxy_set_header Host $http_host;
        proxy_set_header Forwarded "for=$remote_addr;proto=$scheme";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Connection "";

        proxy_http_version 1.1;
        proxy_pass $upstream_seafile;
    

    }
    

        location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;        
        proxy_request_buffering off;
    }


}

Is this config correct?
I also use seafile not installed via a docker container. I also have a separate server with ngenix proxy manager which redirects from URL to 192.168.0.119:800
and receives an https certificate. Can I have problems with access speed and excessive buffering when downloading files? If so, how can I disable it?