如何配置 nginx 以显示 .ipynb scipy 笔记本而不下载它们

时间:2021-06-24 21:44:14

标签: nginx

我试过 How to configure nginx to show file content instead of downloading it? 但它对我不起作用。

这是我的 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 中尝试了 types 指令,但似乎都没有任何区别。目前有一个 ipynb 文件夹上传到服务器,您可以亲眼看到它只是下载而不是显示内容。 (当我说显示它的内容时,我并不是说将它呈现为一个 scipy 笔记本,而只是显示原始 JSON 内容。)

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

0 个答案:

没有答案