PHP implementation of gzip configuration and modification methods in Apache environment

Source: Internet
Author: User
Tags ftp transfer
This article mainly introduces PHP in the Apache environment to implement the Gzip configuration method, a more detailed analysis of the relevant configuration file modification skills, very practical value, the need for friends can refer to the next

The example in this paper describes how PHP implements gzip configuration in Apache environment. Specific as follows:

1, conf/httpd.conf

1) Remove #loadmodule headers_module modules/mod_headers.so in front of the note #,
2) Add LoadModule deflate_module modules/mod_deflate.so,
3) Remove the comment # in front of # include conf/extra/httpd-vhosts.conf.

2, conf/extra/httpd-vhosts.conf in the VirtualHost add

<location "/" > Setoutputfilter DEFLATE browsermatch ^mozilla/4 gzip-only-text/html browsermatch ^Mozilla/4\.0[ 678] No-gzip browsermatch \bmsie!no-gzip!gzip-only-text/html setenvifnocase request_uri \. (?: gif|jpe?g|png) $ no-gzip dont-vary Header append vary user-agent env=!dont-vary</location>

For example:

<virtualhost *:80> documentroot "d:/apache2.2/htdocs/wef" <location "/" >  setoutputfilter DEFLATE  browsermatch ^MOZILLA/4 gzip-only-text/html  Browsermatch ^mozilla/4\.0[678] no-gzip  browsermatch \bmsie!no-gzip!gzip-only-text/html  SetEnvIfNoCase Request_uri \. (?: gif|jpe?g|png) $ no-gzip dont-vary  Header append vary user-agent env=!dont-vary </location></ Virtualhost>

Summary : The above is the entire content of this article, I hope to be able to help you learn.

Related recommendations:

Php method for FTP transfer of files based on Curl

PHP read-write operations for databases and random number operations

PHP simulation QQ login based on Curl operation

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.