The Apache HTTP Server is one of the world’s most widely used web servers and can be configured in different ways to meet the needs of various websites. The Apache Multi-Processing Module (MPM) is the module that manages the process of the Apache server. Two of the most popular MPMs are the Prefork and Worker MPMs. In this article, we will show you how to change the Apache Prefork MPM to the Worker MPM on CentOS systems.
Before You Begin
Before making any changes to your Apache configuration, it is recommended to back up your current Apache configuration files. You can do this by creating a copy of the Apache configuration file and storing it safely.
Additionally, make sure that you have the necessary permissions to make changes to your Apache configuration. On CentOS systems, you will need to use the sudo command to perform the steps outlined in this article.
Step 1: Edit Apache Configuration File
The Apache Prefork MPM is enabled by default on CentOS systems.
- To disable it, open the Apache MPM configuration file
"/etc/httpd/conf.modules.d/00-mpm.conf"
in a text editor:sudo nano /etc/httpd/conf.modules.d/00-mpm.conf
- Now, comment out the current active MPM module as below:1# LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
- Then enable the Apache Worker MPM, and uncomment the following line in the Apache configuration file:1LoadModule mpm_worker_module modules/mod_mpm_worker.so
- Your configuration file may look like the below:
- Save changes and close the file. After you have enabled the Apache Worker MPM, you need to restart the Apache server for the changes to take effect. To restart Apache, run the following command:
sudo systemctl restart httpd
Step 3: Verify Changes
Run the following command to view the currently active MPM module in the Apache web server.
apachectl -V | grep MPM
Conclusion
In this article, we showed you how to change the Apache Prefork MPM to the Worker MPM on CentOS systems. The Apache Worker MPM is better suited for high-traffic websites and can handle a more significant number of concurrent connections than the Apache Prefork MPM. If you have any questions or encounter any issues during the process, please leave a comment below.