This module is nginx third-party module Nginx-http-concat, which can consolidate resources, save bandwidth and save request response time
git clone git://github.com/alibaba/nginx-http-concat.git
Official website explanation
Https://github.com/alibaba/nginx-http-concat
This module is first compiled into Nginx.
/usr/local/nginx/sbin/nginx-v
Nginx version:nginx/1.13.9
Built by GCC 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
Built with OpenSSL 1.0.1e-fips 2013
TLS SNI Support Enabled
Configure arguments:--prefix=/usr/local/nginx --add-module=/root/nginx-1.13.9/nginx-http-concat -- ADD-MODULE=/ROOT/NGINX-1.13.9/NAXSI-0.56RC1/NAXSI_SRC--with-http_secure_link_module--with-http_stub_status_ Module--with-http_auth_request_module--with-http_image_filter_module--with-http_slice_module--with-mail-- With-threads--with-file-aio--with-stream--with-mail_ssl_module--with-http_sub_module--with-http_dav_module-- With-http_flv_module--with-http_mp4_module--with-http_gunzip_module--with-http_gzip_static_module--with-http_ Random_index_module--with-pcre--with-http_ssl_module--with-http_v2_module--with-http_realip_module--with-http_ Addition_module && Make
Put the newly compiled/objs/nginx in the/usr/local/nginx/sbin and put the old nginx back up.
Start editing the nginx.conf file in the Conf directory
Add the following configuration file in the server field
location/css/{
Concat on; #开启资源合并
Concat_max_files 20; #允许合并的最大资源数目
Concat_unique on; #允许合并不同类型资源
Concat_ignore_file_error on; #忽略404或403错误
}
location/js/{
Concat on; #开启资源合并
Concat_max_files 20; #允许合并的最大资源数目
Concat_unique on; #允许合并不同类型资源
Concat_ignore_file_error on; #忽略404或403错误
}
Check for configuration file Restart after editing is complete
/usr/local/nginx/sbin/nginx-t
Nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/usr/local/nginx/conf/nginx.conf Test is successful
/usr/local/nginx/sbin/nginx-s Reload
Open the browser to see the server Page response speed, there will be a significant increase.
At this point, the Nginx-http-concat module compilation configuration is complete
Order a cup of Starbucks
Nginx Resource Merging Optimization module Nginx-http-concat