14

这些是我启用的模组:

alias auth_basic authz_default authz_groupfile authz_host authz_user autoindex deflate dir env mime negotiation php5 reqtimeout rewrite setenvif status

我试图尽可能减少 Apache 的内存占用。

谁能指导我正确的方向,哪些是我绝对需要的,哪些是可选的?我计划运行 Symfony,但我找不到任何关于 symfony 的要求来让它全部运行。

4

6 回答 6

9

好吧,您可以从禁用所有auth/authz模块开始,除非您要让 Apache 为您执行身份验证工作,在这种情况下,只启用auth您实际要使用的模块。

你可能并不真的需要这个autoindex模块;只有当您希望 Apache 自动生成索引文件时才需要它。

deflate——你确实想要这样,所以 Apache 可以在发送回客户端之前对数据进行 gzip 压缩(显着减少流量)。

reqtimeout——那是实验性的。不确定您是否有意将其包含在内。

于 2010-10-10T05:50:21.043 回答
2

我最近阅读了一个网页,其中详细介绍了可以安全删除哪些 Apache 模块。他考虑了最常见的用例,但您应该始终在事后检查并重新启用您确实需要的内容

这是作者启用的模块列表:

core_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
mpm_event_module (static)
http_module (static)
so_module (static)
auth_basic_module (shared)
authn_file_module (shared)
authz_host_module (shared)
authz_user_module (shared)
expires_module (shared)
deflate_module (shared)
headers_module (shared)
dir_module (shared)
mime_module (shared)
setenvif_module (shared)
rewrite_module (shared)
proxy_module (shared)
proxy_fcgi_module (shared)

该页面包含 CentOS 和 Ubuntu 服务器的详细信息。我强烈建议阅读整个页面,因为它包含有关某些软件包被留下或被禁用的详细信息以及提示。

于 2014-10-27T08:35:51.070 回答
1

我只使用:dir、php5、authz_host、mime、rewrite。

禁用无用的模块将为您节省大量资源。

我建议您一一禁用并每次重新启动apache并进行测试。另请注意您在开始时拥有哪些模块,以防出现错误以将其还原

于 2010-11-16T14:29:25.957 回答
1

我创建了一个小的 python 脚本来帮助你。请查看https://github.com/zioalex/unused_apache_modules

这是您可以期待的:

curl http://localhost/server-info > http_modules_test.txt
cat http_modules_test.txt| python find_unused_apache_mod.py

1
Module name mod_python.c
Configuration Phase Participation: 4
Request Phase Participation: 11
Current Configuration: 3

2
Module name mod_version.c
Configuration Phase Participation: 0
Request Phase Participation: 0
Current Configuration: 1

3
Module name mod_proxy_connect.c
Configuration Phase Participation: 0
Request Phase Participation: 0
Current Configuration: 0

To remove safely:
 ['mod_proxy_connect.c']
POPPED:  mod_proxy_connect.c

To KEEP:  ['mod_python.c', 'mod_version.c', 'mod_proxy_connect.c']
于 2018-07-19T16:16:01.870 回答
0

我将启用的模块列表从actions alias auth_basic auth_digest authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi dav dav_fs dav_svn deflate dir env fcgid mime negotiation php5 proxy proxy_balancer proxy_connect proxy_http reqtimeout rewrite ruby setenvif ssl status suexec一个更轻的:authz_host deflate dir fcgid mime php5 rewrite.

于 2014-05-06T08:02:11.410 回答
0

注释掉或禁用所有模块。

while fails $(apachectl configtest) # or apache2ctl configtest on debian
do
 if directive needed
  Add in the module that supplies the directive complained about.
 else
  delete directive
 fi
done

这比一个一个地注释掉它们更容易,你最终得到了最小的集合。事后进行测试以确保一切正常,但我已经将它作为一个过程使用了几次,没有出现重大问题,但理论上无配置模块可能会失败(如果存在这样的事情)。

于 2014-02-19T11:56:30.447 回答