【问题标题】:Tuning AWS Apache Server调整 AWS Apache 服务器
【发布时间】:2019-09-28 04:14:22
【问题描述】:

我正在尝试调整我的 AWS apache 服务器。我看过了:

$: httpd/conf/httpd.conf

我找不到要编辑的部分:

<IfModule prefork.c>
    StartServers            10
    MinSpareServers         10
    MaxSpareServers         25
    ServerLimit             128
    MaxClients              128
    MaxRequestsPerChild     0
</IfModule>

上面的设置如果不在哪里可以找到:httpd/conf/httpd.conf

【问题讨论】:

  • 这是什么操作系统?我推荐cding 到httpd 目录并输入:grep -r StartServers * 来查找文件。
  • 我正在使用运行 wordpress 的 AWS LAMP 堆栈。 Apache 正在使用 prefork 模块。当我访问文件 httpd/conf/httpd.conf 时,除了上面提到的 设置之外,所有内容都在文件中。根本没有那种类型的设置。我可以添加它们吗?还是它们会在其他地方的不同文件中?

标签: apache performance amazon-ec2


【解决方案1】:

确保 prefork 模块已启用(除非您禁用它,否则默认情况下已启用)。

您要查找的部分位于 prefork 配置文件中,在本例中,位于启用的模块目录中:

   /etc/apache2/mods-enabled/mpm_prefork.conf

【讨论】:

    【解决方案2】:

    这取决于 apache 是如何编译的。如果 apache 是使用 mod_event 而不是 prefork 编译的,那么 apache httpd.conf 文件中可能不存在该部分。在 redhat/centos 发行版中,httpd.conf 文件的默认位置在 /etc/httpd/conf。在 debian/ubuntru 发行版上,您会在 /etc/apache2 中找到 httpd.conf

    【讨论】:

      【解决方案3】:

      影响 apache 性能的因素有很多。

      1. 调优 JVM
      2. 日志轮换政策
      3. 调整 linux 内核参数
      4. 调整 apache MPM

      我假设您已经完成了前 3 个步骤,并想了解第 4 个。

      第 4 步。使用命令检查您正在使用的 MPM:

      [root@mohitm ~]# apachectl -V|grep "Server MPM:"
      Server MPM:     prefork
      [root@mohitm ~]#
      

      定位 httpd 配置文件

      $ /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE
      
      -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
      
      #
      # MinSpareServers: minimum number of server processes which are kept spare
      # MaxSpareServers: maximum number of server processes which are kept spare
      # ServerLimit: maximum value for MaxClients for the lifetime of the server
      # MaxClients: maximum number of server processes allowed to start
      # MaxRequestsPerChild: maximum number of requests a server process serves
      
      <IfModule prefork.c>
      StartServers      16
      MinSpareServers   10
      MaxSpareServers   20
      ServerLimit      5024
      MaxClients       5024
      MaxRequestsPerChild     10000
      </IfModule>
      
      #

      【讨论】:

      • 我知道我需要编辑 但文件:/etc/httpd/conf/httpd.conf 不包含它。我还能在哪里找到它?
      • 找到 . -type f -name 'httpd.conf';如果不工作,那么分享操作系统版本
      • 得到了您的查询,已编辑解决方案。 $ /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE
      【解决方案4】:

      Amazon Linux 上的 Apache 主配置文件:

      /etc/httpd/conf/httpd.conf
      

      其他配置加载文件:

      - conf.modules.d/*.conf
      - conf.d/*.conf
      

      我找不到部分,然后我添加到主文件并解决了我的问题。

      【讨论】:

        猜你喜欢
        • 2017-07-09
        • 2013-11-12
        • 1970-01-01
        • 1970-01-01
        • 2019-01-21
        • 2020-01-02
        • 2017-04-19
        • 1970-01-01
        • 2014-04-28
        相关资源
        最近更新 更多