{ pkgs, ... }: { services.seafile = { enable = true; seafileSettings = { fileserver.host = "0.0.0.0"; fileserver.port = 8082; }; ccnetSettings.General.SERVICE_URL = "http://file.mossnet.lan"; adminEmail = "anish@lakhwara.com"; initialAdminPassword = "arandompasswordsecure!"; }; services.nginx = { enable = true; }; services.nginx.upstreams."gunicorn_seafile" = { servers."unix:/run/seahub/gunicorn.sock" = { }; }; services.nginx.upstreams."seafhttp" = { servers."127.0.0.1:8082" = { }; }; services.nginx.virtualHosts."file.mossnet.lan" = { serverName = "file.mossnet.lan"; locations."/" = { proxyPass = "http://gunicorn_seafile"; # without a trailing / extraConfig = '' 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 X-Forwarded-Host $server_name; #proxy_set_header Host $host; proxy_read_timeout 1200s; client_max_body_size 0; # disable max upload size ''; }; locations."/seafhttp" = { proxyPass = "http://seafhttp"; # without a trailing / extraConfig = '' rewrite ^/seafhttp(.*)$ $1 break; client_max_body_size 0; proxy_connect_timeout 36000s; proxy_read_timeout 36000s; proxy_send_timeout 36000s; proxy_request_buffering off; send_timeout 36000s; ''; }; }; }