简体   繁体   中英

How do I gzip my html source

I would like to gzip the html sources of my webpages, what's the best way to do it on a lighttpd/php5 server.

I have tried to do it by editing my php.ini file with:

zlib.output_compression = On
zlib.output_handler = On

but it seems to be a transparent compression only.

You'll need to enable mod_compress on lighthttpd in addition to the changes you made in your php file.

http://www.cyberciti.biz/tips/lighttpd-mod_compress-gzip-compression-tutorial.html

Edit:

I believe you're looking for an html minimizer then. If you check out the headers that google is sending back they look like this:

(Status-Line)   HTTP/1.1 200 OK
Date    Thu, 22 Oct 2009 18:28:47 GMT
Expires -1
Cache-Control   private, max-age=0
Content-Type    text/html; charset=UTF-8
Content-Encoding    gzip
Server  gws
Content-Length  3519
X-XSS-Protection    0

The "Content-Encoding gzip" is what you're looking for if you want to check for to see if your webserver is properly compressing your files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM