加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

Nginx默认内容类型

发布时间:2020-12-13 21:01:16 所属栏目: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 { }

我想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_type或http://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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读