Home > Backend Development > PHP Tutorial > nginx js/css merge request (nginx-http-concat-master) module shoemaster master kangmaste

nginx js/css merge request (nginx-http-concat-master) module shoemaster master kangmaste

WBOY
Release: 2016-07-29 08:55:00
Original
1508 people have browsed it

nginx-http-concat-master is a file merging module for nginx developed by Taobao. It is mainly used to merge front-end code and reduce the number of http requests. If nginx is deployed in your application environment, you can consider trying this module to reduce the number of requests.

The nginx-http-concat-master module mainly contains two configuration parameters, concat and concat_unique. concat is used to turn on or off the request merging function, which can be applied to http, server, location; and concat_unique is used to configure whether only Allows files of the same type (same MIME files) to be merged and applies to http, server, and location sections.


1. concat

Grammar: concat on | off
Default: concat off
Configuration section: http, server, location

is mainly used to set on or off the request merging function. The default is off, such as (turning on the concat function):

nginx js/css merge request (nginx-http-concat-master) module shoemaster master kangmaste

Note:
The default type of concat_types MIME is: text/css application/x-javascript. Of course, it can also be set through concat_types MIME types.


2. concat_unique

Grammar: concat_unique on | off
Default: concat_unique on
Configuration section: http, server, location

Whether only files of the same type (same MIME files) are allowed to be merged. For example, if set to off, then js and css files can be merged; by default, this value is on, which means that only files of the same type can be merged; if you want js and css to be merged into one request, then you must set concat_unique off, other types of files can also be merged in the same way. For example (allowing different types of MIME files to be merged):

nginx js/css merge request (nginx-http-concat-master) module shoemaster master kangmaste


3. concat_max_files

Syntax: concat_max_files number
Default: concat_max_files 10
Configuration section: http, server, location

Define the number of files allowed to be merged in a given configuration section. The default is up to 10. However, be sure to note that the uri should not exceed the page size specified by the system. You can obtain it by executing getconf PAGESIZE in Linux. System limitations, usually the limit is 4096 bytes.

nginx js/css merge request (nginx-http-concat-master) module shoemaster master kangmaste

If the maximum number of merged files is configured to be 20, the average size of each merged file is 4096/20, about 200 bytes each.

nginx js/css merge request (nginx-http-concat-master) module shoemaster master kangmaste


4. Configuration and usage examples

concat on;
Enable request file merging function

concat_max_files 20;
Define the maximum number of files to merge as 20

concat_unique off;
Allow different types of files to be merged

nginx js/css merge request (nginx-http-concat-master) module shoemaster master kangmaste

Module address: https://yunpan.cn/cqSKP6BrJ2AeT Access password 4f50

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the nginx js/css merge request (nginx-http-concat-master) module, including CONCAT and master content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template