Submitted by yngens on Mon, 12/19/2016 - 22:41
Before diving into experiments I'd like to hear *min team's advice on how to properly switch from Apache prefork to worker mode on CentOS 7.x based system. In particular, I'd like to get what Eric said on https://www.virtualmin.com/node/27691 confirmed once again - do we indeed remove the "virtualmin-base" package? And what about Hal9000's unanswered question there:
However several packages remain in the autoremove state, which i don't feel very comfortable with.
I'd like to do this switch scrupulously and only in the recommended by your team, guys, so to avoid problems in the future.
Status:
Active
Comments
Submitted by andreychek on Tue, 12/20/2016 - 08:15 Comment #1
Howdy,
That works differently on Debian/Ubuntu, than it does on CentOS.
And actually, it's a bit easier now on Debian/Ubuntu now, for those it's just a matter of running "apt-get install apache2-mpm-worker".
I hadn't tried that on CentOS recently -- looking into it, it looks like they've made it a config option on CentOS 7.
Take a look at the "/etc/httpd/conf.modules.d/00-mpm.conf" file. You should be able to comment out the "prefork" LoadModule line, and uncomment the "worker" LoadModule line.
Note that mod_php doesn't typically work with the worker mode. I suspect you'll end up needing to disable that as well.
Once you disable mod_php, all of the "php_value" and "php_admin_value" lines in your Apache config will stop working.
What you'll need to do is go through the config, and comment each of those out.
Things should work fine after commenting those out though.
Submitted by yngens on Tue, 12/20/2016 - 08:54 Comment #2
I see. Do you guys ever plan to make switching by one-lick style possible through UI?
Submitted by andreychek on Tue, 12/20/2016 - 09:03 Comment #3
So far that's not something we've discussed, so it probably won't happen in the near future.
It's not too difficult to do the above steps though, the hardest part is in commenting out those various lines.
Submitted by yngens on Tue, 12/20/2016 - 20:11 Comment #4
I believe so.
However, it would be really nice if Virtualmin had the native option to easily change from one mode to another. Our research on the subject matter shows that while Apache prefork is ok for smaller projects for larger setups it is recommended to go Apache worker. So I believe if Virtualmin is also meant to be successful in becoming hosting companies' choice of a control panel and not only of individual users, then it has to offer this feature natively. I would even fancy that Apache Worker should become the default one as it promises more efficient utilization of resources, so all Virtualmin community would gain.
So I am turning this to feature request if you don't mind. I understand that it might be realized not very soon, but please at least consider of doing this sometime in the future.
Submitted by yngens on Tue, 12/20/2016 - 22:27 Comment #5
Submitted by JamieCameron on Tue, 12/20/2016 - 22:44 Comment #6
We'll look into it, however the lack of compatability with mod_php is probably a dealbreaker for most people.
Submitted by yngens on Tue, 12/20/2016 - 23:19 Comment #7
Jamie,
For most people could be, but from a hosting provider's perspective we should be able to provide customers any mode they request.
Eric,
You said:
How do we disable mod_php in proper way not to break anything on Virtualmin? Is running "yum remove mod_php" would be ok?
Submitted by andreychek on Wed, 12/21/2016 - 08:58 Comment #8
Looking into it, it looks like the PHP config now tests to see whether it's the prefork or worker mode that's enabled, before attempting to load mod_php.
It won't try to load mod_php if it's using the worker mode.
That means switching to the worker mode should actually work just fine with mod_php installed.
Submitted by ckwsp101 on Thu, 04/06/2017 - 10:48 Comment #9
Smaller CentoOS 7.x sites may want to use worker mode. The quality of service module mod_qos feature set is limited when deployed under prefork mode.