Deploy Seafile with Nginx

Deploy Seahub/FileServer with Nginx

Seahub is the web interface of Seafile server. FileServer is used to handle raw file uploading/downloading through browsers. By default, it listens on port 8082 for HTTP request.

Here we deploy Seahub using fastcgi, and deploy FileServer with reverse proxy. We assume you are running Seahub using domain ‘’’www.myseafile.com’’’.

This is a sample Nginx config file.

  1. server {
  2. listen 80;
  3. server_name www.myseafile.com;
  4. proxy_set_header X-Forwarded-For $remote_addr;
  5. location / {
  6. fastcgi_pass 127.0.0.1:8000;
  7. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  8. fastcgi_param PATH_INFO $fastcgi_script_name;
  9. fastcgi_param SERVER_PROTOCOL $server_protocol;
  10. fastcgi_param QUERY_STRING $query_string;
  11. fastcgi_param REQUEST_METHOD $request_method;
  12. fastcgi_param CONTENT_TYPE $content_type;
  13. fastcgi_param CONTENT_LENGTH $content_length;
  14. fastcgi_param SERVER_ADDR $server_addr;
  15. fastcgi_param SERVER_PORT $server_port;
  16. fastcgi_param SERVER_NAME $server_name;
  17. fastcgi_param REMOTE_ADDR $remote_addr;
  18. access_log logs/seahub.access.log;
  19. error_log logs/seahub.error.log;
  20. }
  21. location /seafhttp {
  22. rewrite ^/seafhttp(.*)$ $1 break;
  23. proxy_pass http://127.0.0.1:8082;
  24. client_max_body_size 0;
  25. }
  26. location /media {
  27. root C:/SeafileProgram/seafile-pro-server-2.1.4/seahub;
  28. }
  29. }

Modify Configurations

Modify ccnet.conf

You can also modify SERVICE_URL via web UI in “System Admin->Settings”. (Warning: if you set the value both via Web UI and ccnet.conf, the setting via Web UI will take precedence.)

  1. SERVICE_URL = http://www.myseafile.com

Note: If you later change the domain assigned to seahub, you also need to change the value of SERVICE_URL.

Modify seafile-data/seafile.conf

Modify the seahub section of seafile-data/seafile.conf:

  1. [seahub]
  2. port=8000
  3. fastcgi=true

Modify seahub_settings.py

You need to add a line in seahub_settings.py to set the value of FILE_SERVER_ROOT. You can also modify FILE_SERVER_ROOT via web UI in “System Admin->Settings”. (Warning: if you set the value both via Web UI and seahub_settings.py, the setting via Web UI will take precedence.)

  1. FILE_SERVER_ROOT = 'http://www.myseafile.com/seafhttp'

Notes when Upgrading Seafile Server

When upgrading seafile server, besides the normal steps you should take, there is one extra step to do: ‘’’Update the path of the static files in your nginx configuration’’’. For example, assume your are upgrading seafile server 2.1.0 to 2.1.1, then:

  1. location /media {
  2. root C:/SeafileProgram/seafile-pro-server-2.1.1/seahub;
  3. }