zoukankan      html  css  js  c++  java
  • Nginx MIME类型配置

    本文记录Nginx静态web服务器中MIME类型的配置项。
     
    1. MIME type与文件扩展映射
    语法:type{...};
    配置块:http、server、location
    定义MIME type到文件扩展名映射时,多个扩展名可以映射到同一个MIME type。
    types {
        text/html html;
        text/html conf;
        image/gif gif;
        image/jpeg jpg;
    }
     
    2. 默认MIME type
    语法:default_type MIME-type;
    默认:default_type text/plain;
    配置块:http、server、location
    当找不到相应的MIME type与文件扩展名的映射时,使用默认的MIME type。
     
    3. 散列桶内存大小
    语法:types_hash_bucket_size size;
    默认:types_hash_bucket_size 32|64|128;
    配置块:http、server、location
    为了提高找到相应MIME type的速度,Nginx使用散列表来保存MIME type与文件扩展名中间的对应关系,该配置设置了每一个散列表占的内存大小。
     
    4. types_hash_max_size
    语法:types_hash_max_size size;
    默认:types_hash_max_size 1024;
    配置块:http、server、location
    该配置影响散列表的冲突概率,该值越大,就会消耗更多内存、但是可以降低散列key的冲突概率,提高检索速度。3、4这个俩个配置与Nginx中server_name的配置思路一致,有兴趣的可以去看一下前面的文章 Nginx静态web服务器01(虚拟主机与请求分发)。
  • 相关阅读:
    重构学习资源
    cannot be cast to javax.servlet.Servlet 解决
    官网下载eclipse
    mapreduce.Job: Running job: job_1553100392548_0001
    IDEA取消形参名显示
    windows下和linux下运行jar
    idea打包可执行jar
    mkdir: Cannot create directory /file. Name node is in safe mode.
    IDEA2018激活码
    HADOOP集群搭建
  • 原文地址:https://www.cnblogs.com/52why/p/13292708.html
Copyright © 2011-2022 走看看