How to specify mimetype of files with no extension in NGINX config?

后端 未结 2 913
天命终不由人
天命终不由人 2021-02-05 08:07

I have a server with nginx. And I have a lot of images - pngs and jpgs saved as files with no extension (like \"123123123_321312\").

When I use tag \"img\" in html page,

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 08:58

    I also have to add.

    Mickaël Le Baillif solution also works if your web page is downloaded instead of executed. Because nginx thinks that it should be default_type application/octet-stream; even though the official documentation says:

    To make a particular location emit the “application/octet-stream” MIME type for all requests, the following configuration can be used

    And points to location /download/ This also gives:

    Resource interpreted as Image but transferred with MIME type application/octet-stream: "http://xxxxx.com/"
    

    Nginx version: 1.6.2

提交回复
热议问题