將apache的prefork改爲worker

1. 檢測apache正在使用哪一個MPM?web

XXX@XXX-ThinkPad-Edge-E431:~$ apachectl -V | grep -i mpm
Server MPM:     prefork

 2. 列出可用的MPM模塊(確保mpm_worker在列表中)apache

XXX@XXX-ThinkPad-Edge-E431:~$ ls /etc/apache2/mods-available/mpm*
/etc/apache2/mods-available/mpm_event.conf
/etc/apache2/mods-available/mpm_event.load
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-available/mpm_prefork.load
/etc/apache2/mods-available/mpm_worker.conf
/etc/apache2/mods-available/mpm_worker.load

 

 3. 列出開啓的MPM模塊(若是mpm_worker沒有開啓,咱們應該開啓mpm_worker,禁用mpm_prefork模塊)ide

XXX@XXX-ThinkPad-Edge-E431:~$ ls -l /etc/apache2/mods-enabled/mpm*
lrwxrwxrwx 1 root root 34 10月 29 11:04 /etc/apache2/mods-enabled/mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
lrwxrwxrwx 1 root root 34 10月 29 11:04 /etc/apache2/mods-enabled/mpm_prefork.load -> ../mods-available/mpm_prefork.load

 

 4. 禁用MPM_PREFORK模塊spa

XXX@XXX-ThinkPad-Edge-E431:~$ sudo a2dismod mpm_prefork 
[sudo] password for XXX: 
Module mpm_prefork disabled.
To activate the new configuration, you need to run:
  service apache2 restart

 

5. 開啓MPM_WORKER模塊rest

XXX@XXX-ThinkPad-Edge-E431:~$ sudo a2enmod mpm_worker 
Considering conflict mpm_event for mpm_worker:
Considering conflict mpm_prefork for mpm_worker:
Considering conflict mpm_itk for mpm_worker:
Enabling module mpm_worker.
To activate the new configuration, you need to run:
  service apache2 restart

 

6. 從新啓動apache服務。code

 

XXX@XXX-ThinkPad-Edge-E431:~$ sudo service apache2 restart
 * Restarting web server apache2                                         [fail] 
 * The apache2 configtest failed.
Output of config test was:
[Wed Jan 06 18:05:55.525309 2016] [:crit] [pid 11501:tid 140459254396800] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
AH00013: Pre-configuration failed
Action 'configtest' failed.
The Apache error log may have more information.

 

 從新啓動時,會報錯誤:待解決orm

7. 檢測apache是否運行在MPM_WORKERserver

XXX@XXX-ThinkPad-Edge-E431:~$ apachectl -V |grep -i mpm
Server MPM:     worker
相關文章
相關標籤/搜索