Compressing content on server before sending it over HTTP is a good practice since it saves a lot of traffic and makes transfers faster.
For example, Prototype.js is 123KB size and after Gzip compression it becomes only 28KB.
GZIP Compression also affects HTML so even primed cache requests that downloads mostly only HTML will be faster.
So we should enable server-side compression of textual components: Stylesheets, Javascript, HTML, XML (there is no need to compress images as they already compressed).
For Apache2:
compression done by mod_deflate
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/x-javascript text/xml
For Lighttpd:
enable mod_compress in lighttpd.conf and add configuration directives:
compress.cache-dir = "/tmp/"
compress.filetype = ("text/plain", "text/html", "application/x-javascript", "text/css", "text/javascript", "text/xml")
Nginx configuration directives:
gzip on;
gzip_min_length 1000;
gzip_types text/html text/plain text/css text/javascript application/x-javascript text/xml;
(See ngx_gzip_module documentation for details)
Besides compression there is minification (removing comments and unnecessary whitespaces) that can further reduce size of Javascript.
Minified Prototype.js becomes 92KB size uncompressed and 23KB compressed, this is 20% less than compressed non-minified script.
There are number of tools for minification exists, I’m using JSMin (http://crockford.com/javascript/jsmin).
I wasn’t able to use the above method on my web host due to their set-up. Alternatively I used php and the zlib extension to compress my files as per the blog below…
http://thewebdevelopmentblog.com/2008/10/tip-speed-up-your-websites-using-gzip-and-merging-files/
The other methods above easier but if you can’t get it to work either look at the link above.
It can also merge your files and cache them to increase loading speed even more.
Cheers!
Jason,
Your tool contains a security hole, you should be careful with file_get_contents.
Now it’s possible to send something like gzip.php?f0=/etc/passwd and stole content of files from the server, for example, source code, database password, etc.
But in general, sure it’s a useful tool (if we fix the issue above) and it can be used on hostings where we cannot change server settings.
Also, I would send 1 month expires header (instead of 3 days) and I would send Last-Modified header so browsers will be able to send conditional requests.
Thanks for the feedback Rain,
I will update the script to only allow .css and .js extensions to be parsed which would solve this issue.
As for the expiry, 3 days is generally fine for my usage, if people want longer expiries it’s easily changed in the php script.
Thanks again.
Beaufort County North Carolina Drug
zyban without prescription
Zyban is a trade name for the medication buproprion.
generic bupropion
Zyban has been on the market since 1986.
http://www.duckbandfun.com/ – zyban medication
comment5, how to keep adderall high, vdxunx, lok adalat pdf articles, wrsypk, doxycycline pain, 846, side affects of cipro, 56886, famvir medication, 928, addictions to carisoprodol, 8PPP, 100 diflucan mg, =P, cardura vs flomax dosing, may, corrected dilantin levels, 01224, actonel osteonecrosis doctor registry, 17390, gaba diazepam, 56557, buy arimidex 1mg 30, 3572, buy buy evista online, jwz, dodmerb waiver accutane, >:[[[, aciphex coupon, >:))), ambien and returning to natural sleep, 8], dostinex consecuensias, 479233, free crestor, vwyo, levaquin bactrim, 487, enalapril lisinapril, >:-((, venta de clomid en el salvador, 8-OOO, actos altace, %[, advair eyes, 8DD, children reaction to tylenol with codeine, 842, avodart stories, 0736, antabuse interactions with perfume, :-]], is effexor a maoi inhibitor, =-((, calan forcat villa rentals, >:-PPP, avandia and lisinopril, mdkj, cozaar discount program, wuw, elavil medicinenet, oogweg, new fda drug name acomplia, 9731, 1buy cialis generic online,
DD, amaryl diabetes medication, sfj, lupron and casodex, 055195, allegra d order, >:-P, allegra zyrtec or claritin for eyes, xas, effects of alcohol on coreg, >:-((, amoxil eardrops, vaq, cymbalta and tyrosine, kjbe, avapro coupons, 063, altace sestral, 8-]], clarinex causes drowsiness, 45010, what is celebrex, xyold, adipex and chantix, lxq, alprazolam usage, 8(((, ativan to wean from versed, jbdyqp, aricept and aids, 154501, diovan hct splitable, yaq, celexa cymbalta, obq,
iodidesek iodidesek
Erectile dysfunction, viagra online, 3151, [URL=http://www.viagraonlineww.com/]viagra online[/URL], ;d, http://www.viagraonlineww.com/ Viagra, xauold.