Home WebServer PanelDirectAdmin Convert MPM prefork to MPM event Apache DirectAdmin

Convert MPM prefork to MPM event Apache DirectAdmin

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

In this tutorial, AZDIGI will show you how to convert MPM prefork to MPM event Apache DirectAdmin to help servers use a webserver running Apache work for better processing speed and fewer resources.

1. What is Apache MPM?

Since Apache version 2.4 (Release January 17, 2012), Apache first introduced us to MPM (Multi-Processing Module), which can be roughly understood as a multiprocessing module, with MPM will change Apache’s behavior such as how requests are received, processed, and forwarded to other components that process them. Apache uses only 1 MPM at a time.

There are currently 3 main types of MPM: prefork, worker, and event.

By default, when installing Apache, we will install the default MPM as prefork, you should only use this MPM if you have special requirements or need to use mod_php, because this type of MPM consumes a lot of processing resources, serving heavy traffic poorly.

For MPM workers, worker has a much better processing ability than prefork when using the same level of resources.

Finally, the MPM event, you can understand the event is the upgraded version of the worker and gives the highest performance. If possible, you should choose this MPM to use.

To see details about Apache MPM types, please refer to the following link:

Convert MPM prefork to MPM event Apache DirectAdmin

To convert MPM prefork to MPM event Apache DirectAdmin, we need to do the following 4 steps.

Step 1: SSH into your DirectAdmin system

To convert MPM prefork to MPM event Apache DirectAdmin, we first need to SSH or access your VPS/server with root privileges. If you do not know how to SSH into your VPS/Server, you can refer to the following tutorial:

After successful SSH, we continue with step 2 to check the type of MPM being used.

Step 2: Check the type of MPM being used

To check the current Apache MPM type, you use the following command:

AZDIGI Tutorial
httpd -V
    

Here is my result.

MPM prefork to MPM event Apache DirectAdmin
By default, when installing Apache, we will install the default MPM as prefork, you should only use this MPM if you have special requirements or need to use mod_php, because this type of MPM consumes a lot of processing resources, serving heavy traffic poorly.

Continue to step 3 to check if your DirectAdmin is using CustomBuild 2.0 version.

Step 3: Check the CustomBuild version

To convert MPM prefork to MPM event Apache DirectAdmin, your VPS/Server needs CustomBuild 2.0 version.

We need to check if the version of CustomBuild we are using is 2.0 or not. To check the version of CustomBuild you are using, please check out the following short tutorial:

In case your CustomBuild version is lower than 2.0 then you need to upgrade CustomBuild 1.x to 2.0 , you can check out the following tutorial:

After having CustomBuild 2.0, we go to step 4 to convert the MPM Apache.

Step 4: Execute the command to convert MPM prefork to MPM event Apache DirectAdmin

To convert MPM prefork to MPM event Apache DirectAdmin, you need to run the following commands:

AZDIGI Tutorial
cd /usr/local/directadmin/custombuild
./build update
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build php d
./build set apache_mpm auto
./build apache
./build rewrite_confs
    

Explanation of the above commands:

  • Command 1: Move into custombuild folder.
  • Command 2: Update custombuild script.
  • Command 3: Change php mod 1 to php-fpm.
  • Command 4: Change php mod 2 to php-fpm.
  • Command 5: Change php mod 3 to php-fpm.
  • Command 6: Change php mod 4 to php-fpm.
  • Command 7: Reinstall all PHP versions on the server to the new php mod.
  • Command 8: Adjust apache_mpm mode to auto (Apache will automatically choose MPM prefork, worker or event depending on php mod, here Apache will choose event when you set everything to php-fpm).
  • Command 9: Start the process of reinstalling Apache with the new configuration.
  • Command 10: Rewrite your custom configuration, and if you want everything to default, skip this command.

The process of reinstalling the entire PHP version on the server to the new php mod (command 7) will take a lot of your time, please remember to wait patiently for the installation process to complete and then continue with commands 8 and 9.

After completing the above 9 commands, we use the httpd -V command to review the newly installed MPM configuration.

MPM prefork to MPM event Apache DirectAdmin
So we have converted MPM prefork to MPM event Apache DirectAdmin complete.

3. Summary

Hopefully, through this article, you have understood how to convert MPM prefork to MPM event Apache DirectAdmin. Converting to the MPM event will help your VPS/Server better handle high-traffic websites and use fewer resources than prefork.

If you find the article useful, don’t forget to rate 5 stars.

Wishing you success.

You can see more useful articles about DirectAdmin at the following link:

If you need assistance, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign