如何禁用apache2中的mod_deflate?

发布于 2024-08-15 09:07:00 字数 119 浏览 2 评论 0原文

如何在 Apache2 中禁用 mod_deflate

  • 对于特定目录中的文件

  • 对于具有扩展名(例如 .py)的所有文件?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风尘浪孓 2024-08-22 09:07:00

您可以设置环境变量no-gzip< /a> 对于该目录/文件类型:

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

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

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
gt;
    SetEnv no-gzip 1
</FilesMatch>
仙女山的月亮 2024-08-22 09:07:00

引用自: scottlinux.com

禁用压缩:
要在 Apache 中禁用压缩,通常您只需禁用模块 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

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
梦断已成空 2024-08-22 09:07:00

不知道这是否是一个通用的解决方案,但它至少对我有用,在某个文件夹中的 .htaccess 文件中为 .py 文件打开 mod_deflate:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文