服务器启动正常,文件上传失败

版本7.0.5,centos7

/seafhttp/upload-aj/4f109595-ac69-4635-aedf-9a4eeabcc437?ret-json=1:1 Failed to load resource: the server responded with a status of 404 (Not Found)
DevTools 无法加载来源映射:无法加载 http://seafile.qiuyoushu.site/media/assets/css/bootstrap.min.css.map 的内容:HTTP 错误:状态代码 404,net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools 无法加载来源映射:无法加载 http://seafile.qiuyoushu.site/media/css/seafile-ui.map 的内容:HTTP 错误:状态代码 404,net::ERR_HTTP_RESPONSE_CODE_FAILURE
请求网址: http://seafile.qiuyoushu.site/seafhttp/upload-aj/e0b01092-dcee-48dc-bb9a-50fb0ca9379f
请求方法: POST
状态代码: 404 Not Found
远程地址: 119.45.165.94:80
引荐来源网址政策: strict-origin-when-cross-origin
Connection: keep-alive
Content-Encoding: gzip
Content-Language: zh-cn
Content-Type: text/html; charset=utf-8
Date: Mon, 13 Dec 2021 06:39:35 GMT
Server: nginx
Transfer-Encoding: chunked
Vary: Accept-Encoding
Vary: Accept-Language, Cookie
Accept: application/json; text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
Content-Disposition: attachment; filename="demo(1).yaml"
Content-Length: 7661
Content-Range: bytes 0-6316/6317
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarymcllnPWI45W0VWrP
Cookie: sfcsrftoken=MCvHJRAUyE3RGW2bmiesD6tjspskPvtMqrqacCZPhxu3PBCY19jMglI2nQTHVUaS; sessionid=t1ru78nlprigy1l2wg35gsv1tbd0ju7l
Host: seafile.qiuyoushu.site
Origin: http://seafile.qiuyoushu.site
Referer: http://seafile.qiuyoushu.site/library/1eb39ebb-0a53-4713-bff0-b58523791245/%E7%A7%81%E4%BA%BA%E8%B5%84%E6%96%99%E5%BA%93/%E5%B7%A5%E5%85%B7
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36

并且logs/seahub.log会有记录:

2021-12-13 06:43:20,625 [WARNING] django.request:152 get_response Not Found: /seafhttp/upload-aj/4a132558-0a8d-4304-9cc9-62b348f5770d
2021-12-13 06:43:20,729 [WARNING] django.request:152 get_response Not Found: /media/assets/css/bootstrap.min.css.map

已经解决,主要是nginx反向代理配置的问题

大佬,方便给一下nginx配置吗

Seafile V12 使用Docker + caddy之后,再用nginx反代:

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name pan.example.com;
ssl_certificate /data/ssl/example.cer;
ssl_certificate_key /data/ssl/example.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
client_max_body_size 1000m;
client_header_timeout 5m;
client_body_timeout 5m;
proxy_connect_timeout 60s;
proxy_read_timeout 1m;
proxy_send_timeout 1m;
location / {
proxy_pass https://192.168.1.222:443; # caddy 所在服务器
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Forwarded $proxy_add_forwarded;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
send_timeout 300s;
proxy_buffering off;
proxy_buffer_size 4k;
client_max_body_size 5g;
proxy_ssl_server_name on;
proxy_ssl_name pan.example.com;
}
access_log /var/log/nginx/pan.log;
}

你这相当于是Nginx SSL 反向代理到 caddy SSL 啊。抛开功能不谈,就算能正常访问,性能上损失也不小吧

建议你取消 caddy ,后端直接用 http 确保能正常访问,前端通过 Nginx + ssl 代理到后端的 seafile 。需要注意的是 seafile 的配置需要使用 Nginx 设定的访问域名

你可以参考 https://wiki.waringid.me/spaces/VirtualReal/pages/73793626/docker-seafile-12.0.11

1 个赞

官方的示例V11及以前都是 Nginx SSL ==> Seafile
V12之后就是 caddy SSL ==> Nginx SSL ==> Seafile
我配置的另一个社区版就用的你这个方式,但是既然官方推荐了,干脆就用官方的方式了,实际上性能的损失小于简单易用
我的外网实际链路:
CDN ==> realm端口转发+frp内网穿透 ==> Nginx SSL ==> caddy SSL ==> Nginx SSL ==> Seafile
没有可感知的性能损失