首页 > 解决方案 > 如何配置 nginx 以显示 .ipynb scipy 笔记本而不下载它们

问题描述

我试过如何配置 nginx 来显示文件内容而不是下载它?它对我不起作用。

这是我的 nginx 配置。

server {
  listen 80;
  root /home/splat/files;
  index index.php index.html index.htm;
  server_name files.kiwiheretic.xyz;
  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;
  access_log /var/log/nginx/files.kiwiheretic.xyz.access.log combined;
  error_log /var/log/nginx/files.kiwiheretic.xyz.eror.log;

location / {
    autoindex on;
 sendfile on;
 types { text/plain ipynb; }

}


}

我已经尝试过使用ipynb.ipynb的类型指令,但似乎都没有任何区别。目前有一个 ipynb 文件夹上传到服务器,您可以自己看到它只是下载而不是显示内容。(当我说显示它的内容时,我并不是说将其呈现为 scipy 笔记本,而只是显示原始 JSON 内容。)

还有什么我可以尝试的吗?

标签: nginx

解决方案


推荐阅读