Use Apache module in Windows to combine multiple JS, CSS to improve Web loading speed _win server

Source: Internet
Author: User

Now the site more and more expressive, page load of JS and CSS naturally more and more. When the site page of JS and CSS too much, the browser to open the page speed will be very slow, significantly reduce the user experience. Using MOD_CONCATX, you can combine multiple files in an HTTP response message, you can effectively increase the loading speed of js/css.

The example effect is as follows:

MOD_CONCATX modules are modified on a mod_concat basis, thanks to their work.

The original Mod_concat module has great reference value, but the actual effect is not big.

The module has the following three issues:

1, each time will be sent back to the client data, no reasonable use of browser caching
2, the existence of security vulnerabilities, resulting in server-side programs are downloaded, such as "/??" Jquery.js,common.php "
3. When merging each file, there is no interval between them, resulting in the content sticking together, which may cause errors.

So I wrote the Mod_concatx module on the basis of mod_concat to solve some of the problems mentioned earlier.

Download Address: Http://xiazai.jb51.net/201501/other/mod_concatx-140709.rar (enclosing source code, DLL, updated apache2.2/2.4 64-bit version)

Google hosted address: http://code.google.com/p/apmod/

How to use:

Copy Code code as follows:

<link href= "/style/?" Css1.css,css2.css,css3.css "type=" Text/css "rel=" stylesheet "/>"
<script src= "/js/?" Js1.js,js2.js,js3.js,js4.js "type=" Text/javascript "></script>

Module configuration:

Open the Apache configuration file httpd.conf

Copy Code code as follows:

LoadModule Concatx_module Modules/mod_concatx.dll

Advanced Configuration: (This is the default configuration, can not be configured)

Copy Code code as follows:

<ifmodule concatx_module>
Concatxdisable off
Concatxcheckmodified on
Concatxseparator on
Concatxmaxsize 1024
Concatxmaxcount 10
Concatxfiletype Js,css
</IfModule>

Detailed Description:

Copy Code code as follows:

Concatxdisable On/off
Whether to use the Mod_concatx module

Concatxcheckmodified On/off
Check to see if the file changes, recommended on

Concatxseparator On/off
Do you want to add newline separation when merging files, recommended on

Concatxmaxsize Digital
Combined file total size limit maximum, recommended not too big

Concatxmaxcount Digital
The total number of merged files limit the maximum, not recommended too big

Concatxfiletype Js,css
Merge file type restrictions, such as without limiting the fill ","

Last language:
It is recommended to compile this module yourself safely and confidently

Post-Improvement direction:
TODO: consider adding JS,CSS compression
TODO: consider supporting Zend-parsed files
BUG: Default page load exception exists for directory (consider Upper hook processing)

If APAHCE cannot start after loading the module, install the VC10 runtime and download the address
http://www.microsoft.com/en-us/download/details.aspx?id=5555

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.