Change server from Apache mod_php to FPM

**Operating system:Ubuntu
**OS version:20.04

I have 2 servers. The first runs Apache mod_php. The second FPM.
I want to change the first one to PHP-FPM for all sites on that server.
In “Server Templates -> PHP Options”, the Apache mod_php is the only available option.

How can I change globally to FPM for the entire server?


You would need to install PHP-FPM package first. Later re-run System Settings > Re-Check Configuration and change execution mode using Server Configuration > Website Options page.

In “Server Templates -> PHP Options”, the Apache mod_php is the only available option.

Afterwards doing the above, this can be changed to PHP-FPM as well but will only affect newly created virtual servers.

1 Like

Isn’t there a way to do it also to all virtual servers right away?

Yes, you’re right, there is.


#!/usr/bin/env bash

doms=`virtualmin list-domains --name-only --no-alias`
for dom in $doms; do
	virtualmin modify-web --domain $dom --mode fpm

Thank you so much Ilia.

Is there also a code to import many sites into Virtualmin?
All are already in /home/(domain)/public_html/

You could also use restore domain CLI command in familiar way, with --all-domains param:

virtualmin restore-domain --source file
                         [--domain name] | [--all-domains]
                         [--feature name] | [--all-features]
                         [--except-feature name]
                         [--reuid | --no-reuid]
                         [--option "feature name value"]
                         [--all-virtualmin] | [--virtualmin config]
                         [--shared-ip address | --ip address |
                          --allocate-ip | --original-ip]
                         [--default-ip6 |
                          --shared-ip6 address | --ip6 address |
                          --allocate-ip6 | --original-ip6]
                         [--only-missing | --only-existing]
                         [--key id]

Thanks Ilia,
But I think that is a bit overkill in my case.
I’m just after a way to import servers in the same way as when I use “Add Servers/Import Virtual Server” and add the domain name.
And I have all server names in a file.

(User names and pw are already in /etc/passwd and a complete MySql db is in place)
I don’t have a compressed backup file.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.