Questions tagged «mime-type»

3
如何确保Nginx将纯文本文件作为下载而不是内联提供?
我有可以与Nginx一起使用的Rails应用程序(Redmine)。如果我单击任何附件,我的浏览器(firefox,即chrome)要求我下载文件。但是,如果我单击txt类型的附件,我的浏览器会在浏览器中打开该文件。 据我了解,Nginx的任务是决定-在浏览器中打开文件还是下载文件。如何设置?
18 nginx  mime-type 

2
我可以将所有目录请求别名到nginx中的单个文件吗?
我试图弄清楚如何在nginx中接收对特定目录的所有请求并返回不带重定向的json字符串。 例: curl -i http://example.com/api/call1/ 预期结果: HTTP/1.1 200 OK Accept-Ranges: bytes Content-Type: application/json Date: Fri, 13 Apr 2012 23:48:21 GMT Last-Modified: Fri, 13 Apr 2012 22:58:56 GMT Server: nginx X-UA-Compatible: IE=Edge,chrome=1 Content-Length: 38 Connection: keep-alive {"logout": true} 到目前为止,我的nginx conf中包含以下内容: location ~ ^/api/(.*)$ { index /api_logout.json; alias /path/to/file/api_logout.json; types { } …

3
nginx,x-accel-redirect和mime类型
在我的nginx 0.8.34设置中,我使用X-Accel-Redirect功能来控制应用程序代码中的文件下载,而不让应用程序自行处理下载。 经过一番痛苦之后,现在这基本上可以工作了,只是nginx总是返回具有text/html内容类型的文件。 默认的内容类型是application / octet-stream,在http块中指定。 除其他外,服务器块还包含文件存储目录的定义: location /files { default_type application/octet-stream; alias /srv/www/uploads; internal; } 因此,即使在这里,我也指定了内容类型,但没有任何变化。 我不想通过应用程序设置Content-Type,因为那样的话我会让我慢下来(我首先必须确定它)。因此,理想情况下,nginx将基于文件扩展名返回正确的mimetype(我确实在http块中包含mime.types )。
9 nginx  mime  mime-type 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.