PHP implements gzip configuration and modification methods in apache environment

墨辰丷
Release: 2023-03-31 16:20:02
Original
1769 people have browsed it

This article mainly introduces the gzip configuration method of PHP in the apache environment, and analyzes the modification techniques of related configuration files in more detail. It is of great practical value. Friends in need can refer to the example of this article.

Describes the gzip configuration method of php in the apache environment. 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.confAdd

<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>
Copy after login

to VirtualHost. 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>
Copy after login

Summary : The above is the entire content of this article, I hope it will be helpful to everyone's study.

Related recommendations:

php method to implement FTP file transfer based on curl

php reads the database Write operations and random number operations

php simulates QQ login based on curl operation

The above is the detailed content of PHP implements gzip configuration and modification methods in apache environment. For more information, please follow other related articles on the PHP Chinese website!

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