How to disable mod_deflate in apache2?

末鹿安然 提交于 2019-11-26 18:14:09

问题


How can I disable mod_deflate in Apache2

  • For files in a specific directory

OR

  • For all files that have extension of, for example .py?

回答1:


You could set the environment variable no-gzip for that directory/type of file:

# for URL paths that begin with "/foo/bar/"
SetEnvIf Request_URI ^/foo/bar/ no-gzip=1

# for files that end with ".py"
<FilesMatch \.py$>
    SetEnv no-gzip 1
</FilesMatch>



回答2:


Quote from: scottlinux.com

Disable Compression: To disable compression in Apache, typically you just need to disable the module mod_deflate...

Debian/Ubuntu:

$ sudo a2dismod deflate
Module deflate disabled.
Run '/etc/init.d/apache2 restart' to activate new configuration!

$ sudo /etc/init.d/apache2 restart



回答3:


Don't know if this is a general solution, but it worked for me at least, to turn of mod_deflate for .py-files within a .htaccess file in a certain folder:

SetEnvIfNoCase Request_URI "\.py$" no-gzip dont-vary


来源:https://stackoverflow.com/questions/1922934/how-to-disable-mod-deflate-in-apache2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!