zoukankan      html  css  js  c++  java
  • 使用 nginx-http-concat

    nginx-http-concat 是一个 Nginx 扩展模块,用来合并 HTTP 请求。

    # 1. 下载

    访问 https://github.com/alibaba/nginx-http-concat/releases

    官网下载最新的源包,如:

    # 下载
    wget https://github.com/alibaba/nginx-http-concat/archive/1.2.2.tar.gz
    
    # 解压并记录解压后的目录
    tar xzf 1.2.2.tar.gz
    

    # 2. 安装

    使用 编译安装 ,在配置 configure 时添加参数:

    # 配置
    ./configure 其他编译参数 --add-module=/刚才解压的目录
    
    # 安装
    make
    [sudo] make install
    

    注意: 如果是重新编译安装时不要运行 make install,可参数: 重新编译安装

    如我的配置:

    ./configure 
        --...
        --add-module=/home/work/src/nginx-http-concat-1.2.2
    

    如果有多个 --add-module 分别对应写上即可

    # 3. 配置

    使用 location 匹配到你想要匹配的路径,对其设置参数:

    server {
        location /static/css/ {
            concat on;
            concat_types text/css;
            concat_max_files 20;
        }
            
        location /static/js/ {
            concat on;
            concat_types application/javascript;
            concat_max_files 30;
        }
    }
    

    重启服务,如: nginx -s reload

    更新配置项点击: https://github.com/alibaba/nginx-http-concat#module-directives

    # 4. 使用

    现在就可以通过url中的??来合并了,比如: /static/css/??a.css,path/b.css

  • 相关阅读:
    文档测试
    浅谈兼容性测试
    配置测试
    测试产品说明书
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
  • 原文地址:https://www.cnblogs.com/weifeng1463/p/13126967.html
Copyright © 2011-2022 走看看