【问题标题】:Configure apache MPM in Beanstalk for a php/symfony site在 Beanstalk 中为 php/symfony 站点配置 apache MPM
【发布时间】:2016-04-26 23:36:07
【问题描述】:

我正在使用 AWS beanstalk 来托管一个 php/symphony 应用程序。 我想正确配置有关机器大小的 apache,目前为 t2.small,即。 1 个核心,2 GB RAM,非常小。

apachectl -V 给了我这个:

Server version: Apache/2.4.16 (Amazon)
Server built:   Aug 13 2015 23:52:13
Server's Module Magic Number: 20120211:47
Server loaded:  APR 1.5.0, APR-UTIL 1.4.1
Compiled using: APR 1.5.0, APR-UTIL 1.4.1
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
  forked:     yes (variable process count)

this doc 开始,我至少需要根据可用 RAM 配置 MPM/prefork 中的 MaxRequestWorkers。

在 beanstalk 中配置它的正确方法是什么?我猜是通过 .ebextensions ?怎么样?

【问题讨论】:

    标签: php apache amazon-web-services amazon-elastic-beanstalk


    【解决方案1】:

    我正在使用.ebextensions

    这是我的.ebextensions/apache.config 设置的一部分,根据您的实例容量和项目需求进行相应调整

    files:
      "/etc/httpd/conf.modules.d/00-mpm.conf":
          mode: "000644"
          owner: root
          group: root
          content: |
            LoadModule mpm_worker_module modules/mod_mpm_worker.so
            ServerLimit         512
            StartServers        100
            MaxRequestWorkers   256
            MinSpareThreads     100
            MaxSpareThreads     300
            ThreadsPerChild     25
    

    这是我的.ebextensions/php.config 优化/设置的一部分,根据您的实例容量进行相应调整

    files:
      "/etc/php.d/52-fscache.ini":
          mode: "000755"
          owner: root
          group: root
          content: |
            [PHP]
            realpath_cache_size = 128M
            realpath_cache_ttl = 120
    
      "/etc/php-5.6.d/10-opcache.ini":
          mode: "00644"
          content: |
            zend_extension=opcache.so
            opcache.enable=1
            opcache.memory_consumption=256
            opcache.interned_strings_buffer=32
            opcache.max_accelerated_files=100000
            ;opcache.max_wasted_percentage=5
            opcache.use_cwd=0
            opcache.revalidate_freq=0
            opcache.revalidate_path=0
            opcache.blacklist_filename=/etc/php-5.6.d/opcache*.blacklist
            opcache.consistency_checks=0
    
    
      "/etc/php.d/51-upload.ini":
          mode: "000644"
          content: |
            post_max_size = 100M
            upload_max_filesize = 10M
    
      "/etc/php-fpm-5.6.d/www.conf":
          mode: "000644"
          content: |
            [www]
            user = webapp
            group = webapp
            listen = 127.0.0.1:9000
            listen.allowed_clients = 127.0.0.1
            ;process.priority = -15
            pm = static
            pm.max_children = 30
            pm.max_requests = 500
            php_admin_value[error_log] = /var/log/php-fpm/5.6/www-error.log
    

    【讨论】:

      猜你喜欢
      • 2018-11-03
      • 2021-12-03
      • 2019-07-07
      • 1970-01-01
      • 2016-08-08
      • 2013-11-16
      • 1970-01-01
      • 1970-01-01
      • 2010-12-28
      相关资源
      最近更新 更多