在 ubuntu 上从 prefork MPM 切换到 worker MPM + php-fpm [英] Switching from prefork MPM to worker MPM + php-fpm on ubuntu

查看:21
本文介绍了在 ubuntu 上从 prefork MPM 切换到 worker MPM + php-fpm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现的所有教程都是如何全新安装 worker MPM + PHP-FPM,因为我的 wordpress 博客已经使用 prefork MPM 启动并运行,如果我在模拟安装过程中错了,请纠正我:

All tutorials I found were how to fresh install worker MPM + PHP-FPM, since my wordpress blog's already up and running with prefork MPM, correct me if I'm wrong in the simulated installation process:

我使用的是 ubuntu,根据一些教程,以下几行代码可以解决所有问题:

I'm on ubuntu and according to some tutorials, the following lines would do all the tricks:

apt-get install apache2-mpm-worker libapache2-mod-fastcgi php5-fpm php5-gd
a2enmod actions fastcgi alias

然后在/etc/apache2/conf.d/php5-fpm.conf中设置配置:

<IfModule mod_fastcgi.c>
                AddHandler php5-fcgi .php
                Action php5-fcgi /php5-fcgi
                Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
                FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
</IfModule>

做完这些,重启:

service apache2 restart && service php5-fpm restart

问题:

1) 对于以前使用 prefork MPM 运行的站点,是否会导致整个过程中的停机时间?

1) Would it cause any down time in the whole process for previously running sites with prefork MPM?

2)您是否需要更改任何已经存在的配置文件,例如 php 或 mysql 或 apache2(它们是否会在您不做任何操作的情况下在切换后立即生效)?

2) Do you have to change any already existent configuration files like php or mysql or apache2(would they take effect immediately after the switch without you doing anything)?

3) 我已经安装并运行了 apc,切换后是否需要重新安装/重新配置?

3) I've already have apc up and running, do you have to re-install/re-configure it after the switch?

4) 如何确定 apache2 是否按预期工作在 worker MPM 模式下?

4) How do you find out if apache2 is working in worker MPM mode as expected?

非常感谢!

推荐答案

  1. 是的,它至少必须替换正在运行的 httpd 进程.你肯定想先在开发设置上测试这个.很容易在配置文件中出现错误,需要一段时间才能弄清楚.

  1. yes, it has to at least replace the httpd process running. you definitely want to test this on a development set up first. it's easy to have a mistake in a config file that takes a while to figure out.

php、mysql 没有变化.是对 apache httpd.conf 进行更改以放入工作人员配置 - 它们与 prefork 设置非常不同.您需要自己在 httpd.conf 中进行这些更改.

no changes to php, mysql. yes changes to apache httpd.conf to put in worker configurations - they are very different from prefork settings. you need to do these changes yourself in httpd.conf.

不,因为这是一个 php 模块,所以只要 php 运行它就可以工作.也就是说,它将为 php-fpm 中的每个池运行一个副本,因此如果您有多个域,您可以将它们分组到一个池中进行共享……但如果这样做,请注意安全问题.

no, since this is a php module, whenever php runs it works. that said, it will run one copy for each pool in php-fpm, so if you have multiple domains, you could group them into a pool to share...but be aware of security concerns if you do that.

httpd -V 显示服务器 mpm"

httpd -V shows "server mpm"

祝你好运!

这篇关于在 ubuntu 上从 prefork MPM 切换到 worker MPM + php-fpm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆