Phpnow Configuring gzip on Windows

Source: Internet
Author: User

From the server-side optimization, the size of the text file can be greatly reduced by compressing the server, so that the speed of loading is multiplied. Currently, a more general compression method is to enable gzip compression. It sends the page that the browser requests, as well as the static resources referenced in the page, to the client in the form of a compressed package, and then completes the decompression and assembly on the client. The implementation does not care, we just have to enable the Gzip. Use the tool to detect the effect of not turning on page compression. The following steps let us specifically turn on Apache-based gzip compression support.

Implementation steps

    1. Locate and open the httpd.conf file in the apache/conf directory

    2. Open the Deflate_module and Headers_module modules in httpd.conf by removing the following two lines in front of them:

      LoadModule Deflate_module modules/mod_deflate.so

      LoadModule Headers_module modules/mod_headers.so

    3. Add the following code at the bottom of the httpd.conf file to configure the files that need to be compressed:

      <ifmodule deflate_module>
      Setoutputfilter DEFLATE
      # Don ' t compress images and other
      Setenvifnocase Request_uri. (?: gif|jpe?g|png) $ no-gzip dont-vary
      Setenvifnocase Request_uri. (?: Exe|t?gz|zip|bz2|sit|rar) $ no-gzip dont-vary
      Setenvifnocase Request_uri. (?:p df|doc) $ no-gzip dont-vary
      Addoutputfilterbytype DEFLATE text/html text/plain text/xml text/css
      Addoutputfilterbytype DEFLATE Application/x-javascript
      </IfModule>

    4. Restart Apache Server

    5. 5

      Use the tool to re-detect whether gzip compression is turned on. Considering the relevant ad detection mechanism, the specific gzip detection tool access address can be found in search engines.

    6. I didn't find any information in the httpd.conf. So I copied this code into the conf, according to the above configuration, from the start of Apache after the detection or prompt No.

      LoadModule Deflate_module modules/mod_deflate.so

    7. After Baidu query.
      Open php-5 under the Phpnow file. 2. 12-win32 folder, locate Php-apache2handler. INI configuration file, open it and find zlib. Output_compression = Off, will be zlib. Output_compression = Off;zlib. Output_compression_level = 1 (Note:-1 for off PHP zlib (gzip) compression) modified to zlib. Output_compression = Onzlib. Output_compression_level = 6; then from the start Apache, and then the test results prompt is.

Phpnow Configuring gzip on Windows

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.