PHP implements gzip configuration method in apache environment, apachegzip_PHP tutorial

WBOY
Release: 2016-07-13 09:58:12
Original
826 people have browsed it

php implements gzip configuration method in apache environment, apachegzip

This article describes the example of php implementing gzip configuration method in apache environment. Share it with everyone for your reference. The details are as follows:

1. conf/httpd.conf

1) Remove the comment # in front of #LoadModule headers_module modules/mod_headers.so,
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
Add
in VirtualHost

<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 \.(&#63;:gif|jpe&#63;g|png)$ no-gzip dont-vary
 Header append Vary User-Agent env=!dont-vary
</Location>
Copy after login

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 \.(&#63;:gif|jpe&#63;g|png)$ no-gzip dont-vary
  Header append Vary User-Agent env=!dont-vary
 </Location>
</VirtualHost>
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/978384.htmlTechArticlephp implements gzip configuration method in apache environment, apachegzip This article describes the example of php implementing gzip configuration method in apache environment . Share it with everyone for your reference. The details are as follows: 1. con...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template