环境:Linux+xampp(Apache+php+mysql)
[inlosc_lg_title]确认 /opt/lampp/etc 下 httpd.conf 扩展开启成功,如果前面有#号 去掉。[/inlosc_lg_title]
LoadModule headers_module modules/mod_deflate.so
LoadModule filter_module modules/mod_filter.so
[inlosc_lg_title]确认 /opt/lampp/etc/extra下 httpd-vhosts.conf如下设置[/inlosc_lg_title]
#只单独网站开启 <VirtualHost *:80> DocumentRoot "/opt/lampp/htdocs/yejiandacn" ServerName www.yejianda.cn ErrorLog "logs/yejianda_log/ErrorLog/error_yejianda" CustomLog "logs/yejianda_log/yejiandalog" common
<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html # or any file type you wish </IfModule>
</VirtualHost> #所有虚拟机网站开启 填在顶部 #Gzip <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html # or any file type you wish </IfModule>
[inlosc_lg_title]爱站工具查看服务器信息 Gzip开启成功[/inlosc_lg_title]
压缩率非常高,网站打开速度秒开。