[英]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. 我想gzip我网页的html源,在lighttpd / php5服务器上做这件事的最好方法是什么。
I have tried to do it by editing my php.ini
file with: 我试图通过编辑我的php.ini
文件来做到这一点:
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. 除了在php文件中所做的更改之外,您还需要在lighthttpd上启用mod_compress。
http://www.cyberciti.biz/tips/lighttpd-mod_compress-gzip-compression-tutorial.html http://www.cyberciti.biz/tips/lighttpd-mod_compress-gzip-compression-tutorial.html
Edit: 编辑:
I believe you're looking for an html minimizer then. 我相信您正在寻找html最小化器。 If you check out the headers that google is sending back they look like this: 如果您查看google发送回的标头,它们将如下所示:
(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. 如果要检查网络服务器是否正确压缩文件,则需要“ Content-Encoding gzip”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.