Resource distribution
I. Public resources
Public resources need to be stored separately, such as: various versions of jquery and compressed versions, ICO icons and other common information
1, avoid visiting our site under different sub-sites need to download the same static resources multiple times the problem
2, avoid the browser to the same domain number of links under the limit, to a certain extent, increase the degree of parallelism
3, Domain name common.xxx.com, sub-domain name, such as: js\css\img
Second, the modularization of resources
Partition the storage of static resources according to business modules and establish corresponding static domain names
such as: Business modules related projects using stat1.xxx.com, Business module two under the relevant projects using Stat2.xxx.com, under different sub-directories, such as: js\css\img
Version Management
First, version number management
1, version number storage Redis-->database
2, Version number management
Naming format: file name + suffix name. extension? v= Version number
Like Baser20151204.css? v=v2015151204
Background management: Establish a unified background for each sub-project under each business module to manage the suffix and version numbers of static resources, without having to put the suffix version number separately in the configuration file. Avoid static resources and application binding relationships, if only static resource changes, to avoid the application of the restart and modification;
Easy fallback, if there is a problem with the newly released static resources, only need to change the suffix and version number to the previous version through background management, and publish the static resources that keep multiple versions.
Ii. release of static resources
Recommendations can be done by static developers, who have developed the relevant resources, published to the test and production environment (without affecting the running of existing projects) following the naming rule name above, and developers who need to switch styles can manage the cut flowers through a post-static resource desk management system.
Cache control One, Access CDN
Second, increase the browser local cache control policy (pending).
Volume control
One, file compression
Gzip, deflate (plan to be determined)
Ii. merger of documents (to be determined)
Image upload Management one, function
Set up a unified upload interface, retain the original image and generated thumbnails, thumbnails by default should support the basic picture size, 72*72, 200*200, etc., but also to support the generation of corresponding thumbnails according to the parameters passed.
Second, storage
Domain name: img.xxx.com, file.xxx.com
The sub-directories are partitioned according to the business modules, such as {a}\{a.1}\a.jpg, where callers provide the relevant business units and project names.
Summarize
Simple carding, not to be continued .....
Small and medium-sized company static resource management deployment scenario