Nginx默认内容类型

我想NGINX发送内容类型的application / xml
对于某个位置的所有响应:

我的配置基于文档http://wiki.nginx.org/HttpCoreModule#types

 server {

      server_name my_name
      listen 8088;
      keepalive_timeout 5;

      location / { 
        proxy_pass http://myhost;

        types         { } 
        default_type  application/xml
     }   
   }

但是服务器总是以内容类型“text / xml”发送.
任何的想法?

最佳答案
xml扩展名的默认类型是text / xml. mime.types文件中描述了此行为.使用http://nginx.org/en/docs/http/ngx_http_core_module.html#default_typehttp://nginx.org/en/docs/http/ngx_http_core_module.html#types覆盖它(设置为application / xml).

apache解决方案httpd:

# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one,such as from filename extensions.
# If your server contains mostly text or HTML documents,"text/plain" is
# a good value.  If most of your content is binary,such as applications
# or images,you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.

DefaultType None

http://httpd.apache.org/docs/current/mod/core.html#defaulttype

相关文章

文章浏览阅读3.7k次,点赞2次,收藏5次。Nginx学习笔记一、N...
文章浏览阅读1.7w次,点赞14次,收藏61次。我们在使用容器的...
文章浏览阅读1.4k次。当用户在访问网站的过程中遇到404错误时...
文章浏览阅读2.7k次。docker 和 docker-compose 部署 nginx+...
文章浏览阅读1.3k次。5:再次启动nginx,可以正常启动,可以...
文章浏览阅读3.1w次,点赞105次,收藏182次。高性能:Nginx ...