Apache is a popular web server that is used by many websites and organizations around the world. It is capable of handling large amount of traffic. Although its default settings allow you to run a website with average traffic, as more people visit your website, you need to take help of its multiprocessing modules. For that purpose, Apache provides MPM (Multi processing module). Sometimes you may need to change Apache prefork to MPM worker. In this article, we will look at how to change Apache prefork to worker in Ubuntu.
But before we proceed, let us quickly understand the difference between MPM prefork and worker. MPM provides two kinds of multi processing modules – prefork and worker. The MPM prefork module runs a single process that launches and manages child processes that listen to connections. It is self-regulating and its default settings are enough to manage a website with large traffic. On the other hand, the MPM worker module turns Apache into a multi-process, multi-threaded server, where each child process under worker can have multiple threads.
How to Change Apache Prefork to Worker in Ubuntu
Before proceeding, please take a backup of your present configuration.
First, verify if your Apache server is running MPM prefork, with the following command. You will see the keyword ‘prefork’ in the output.
$ apachectl -V | grep -i mpm Result: Server MPM: prefork
Then disable MPM prefork, with the following command.
$ sudo a2dismod mpm_prefork
Next, enable MPM worker with the following command.
$ a2enmod mpm_worker
Now verify that your Apache server is running MPM worker, with the following command. You will see the keyword ‘worker’ in the output.
apachectl -V | grep -i mpm Result: Server MPM: worker
Please note, both MPM prefork and worker are mutually exclusive modules and cannot run together. If you enable one of them, you must disable the other.