https://manual.seafile.com/deploy_windows/deploy_with_nginx.html
使用Nginx 部署seafile
部署 Seahub/FileServer 使用Nginx
Seahub 是webSeafile server的web 接口,FileServer 是用于处理文件上传下载通过浏览器。
默认, 它侦听在8082 端口用于HTTP 请求
我们部署Seahub 使用fastcgi,不是FileServer 使用反向代理,我们假设运行Seahub 使用域名'''www.myseafile.com'''.
This is a sample Nginx config file.
server {
listen 80;
server_name www.myseafile.com;
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 logs/seahub.access.log;
error_log logs/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
}
location /media {
root C:/SeafileProgram/seafile-pro-server-2.1.4/seahub;
}
}
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.)
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:
[seahub]
port=8000
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.)
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:
location /media {
root C:/SeafileProgram/seafile-pro-server-2.1.1/seahub;
}