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

后端 未结 2 918
天命终不由人
天命终不由人 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 09:13

    You should use the default_type directive :

    server {
       ...
       default_type text/html;
    
       location /images/png {
          default_type image/png;
       }
    
       location /images/jpg {
          default_type image/jpeg;
       }
    }
    

提交回复
热议问题