这里以https://i.hivps.cn直接访问Seafile为例
server { listen 80; server_name i.hivps.cn; rewrite ^ https://$http_host$request_uri? permanent; } server { listen 443 ssl; ssl on; ssl_certificate fullchain.pem; ssl_certificate_key privkey.pem; server_name i.hivps.cn; 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 /www/server/nginx/logs/seahub.access.log; error_log /www/server/nginx/logs/seahub.error.log; } 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; } location /media { root /data/ifiles/seafile-server-latest/seahub; } }
补充:配置文件中的
/data/ifiles/seafile-server-latest/seahub 请自行替换为你的seahub所在目录,不然会CSS丢失
location/media{
root/data/ifiles/seafile-server-latest/seahub;}
设置后,Seafile后台对应设置参考如下: