1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ApacheのeventMPMとphp-fpmで運用

Posted at

環境

CentOS Linux release 7.6.1810 (Core)

参考サイト

手順

サイトを見ながらやればおkでした。

ApacheのeventMPM

cd /etc/httpd/conf.modules.d/
cp -p 00-mpm.conf 00-mpm.conf.20190304.bak
vi 00-mpm.conf

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
をコメントアウトして
LoadModule mpm_event_module modules/mod_mpm_event.so
のコメントを外す

systemctl restart httpd
httpd -M | grep mpm
 mpm_event_module (shared)

php-fpm

yum -y install --enablerepo=remi,remi-php73 php-fpm
cp -p /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.20190304.bak
vi /etc/php-fpm.d/www.conf

適宜変更(運用してみて調整するっぽい)

systemctl start php-fpm
systemctl enable php-fpm

PHPをCGIで動かす

vi /etc/httpd/conf/httpd.conf

最後に追記
# event MPM setting
<IfModule mpm_event_module>
        StartServers             2
        MinSpareThreads         25
        MaxSpareThreads         50
        ThreadsPerChild         50
        MaxRequestWorkers       50
        MaxConnectionsPerChild   0
       <FilesMatch \.php$>
                SetHandler "proxy:fcgi://127.0.0.1:9000"
       </FilesMatch>
</IfModule>

モジュール版PHPの設定を読み込まないようにする
mv /etc/httpd/conf.modules.d/15-php.conf /etc/httpd/conf.modules.d/15-php.conf.20190304.bak

systemctl restart httpd

気になるところ

  • 各サイトのエラーログが別々のファイルにできない?

バーチャルホストの設定にて

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /home/example/public_html
    ErrorLog /home/example/logs/error_log
    CustomLog /home/example/logs/access_log common
    <Directory /home/example/public_html>
        AllowOverride All
        Options All -Indexes
        Order allow,deny
        Allow from all
        SetEnv PHP_VALUE "error_log = /home/example/logs/error_log"
    </Directory>
</VirtualHost>

とすると、設定を上書きできるので、エラーログを個別に設定可能

  • 運用してみて調整が必要
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?