Failed to start The Apache HTTP Server

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04
Virtualmin version 7.3-1

Howdy

under the command systemctl status apache2.service I get that:

`× apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-11-22 08:58:08 UTC; 10s ago
Docs: Apache HTTP Server Version 2.4 Documentation - Apache HTTP Server Version 2.4
Process: 1827311 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
CPU: 23ms

Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: Starting The Apache HTTP Server…
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827314]: AH00526: Syntax error on line 26 of /etc/apache2/sites-e>
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827314]: Invalid command ‘FCGIWrapper’, perhaps misspelled or def>
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827311]: Action ‘start’ failed.
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827311]: The Apache error log may have more information.
Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: apache2.service: Control process exited, code=exited, status=1/F>
Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: apache2.service: Failed with result ‘exit-code’.
Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: Failed to start The Apache HTTP Server.
…skipping…
× apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-11-22 08:58:08 UTC; 10s ago
Docs: Apache HTTP Server Version 2.4 Documentation - Apache HTTP Server Version 2.4
Process: 1827311 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
CPU: 23ms

And under the command journalctl -xeu apache2.service:

░░ The job identifier is 292603.
Nov 22 08:56:33 host.borsedilussoartigianali.com apachectl[1827057]: AH00526: Syntax error on line 26 of /etc/apache2/sites-enabled/corriere24.com.conf:
Nov 22 08:56:33 host.borsedilussoartigianali.com apachectl[1827057]: Invalid command 'FCGIWrapper', perhaps misspelled or defined by a module not included in the server configuration
Nov 22 08:56:33 host.borsedilussoartigianali.com apachectl[1827054]: Action 'start' failed.
Nov 22 08:56:33 host.borsedilussoartigianali.com apachectl[1827054]: The Apache error log may have more information.
Nov 22 08:56:33 host.borsedilussoartigianali.com systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit apache2.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 22 08:56:33 host.borsedilussoartigianali.com systemd[1]: apache2.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit apache2.service has entered the 'failed' state with result 'exit-code'.
Nov 22 08:56:33 host.borsedilussoartigianali.com systemd[1]: Failed to start The Apache HTTP Server.
░░ Subject: A start job for unit apache2.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit apache2.service has finished with a failure.
░░
░░ The job identifier is 292603 and the job result is failed.
Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: Starting The Apache HTTP Server...
░░ Subject: A start job for unit apache2.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit apache2.service has begun execution.
░░
░░ The job identifier is 292686.
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827314]: AH00526: Syntax error on line 26 of /etc/apache2/sites-enabled/corriere24.com.conf:
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827314]: Invalid command 'FCGIWrapper', perhaps misspelled or defined by a module not included in the server configuration
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827311]: Action 'start' failed.
Nov 22 08:58:08 host.borsedilussoartigianali.com apachectl[1827311]: The Apache error log may have more information.
Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit apache2.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: apache2.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit apache2.service has entered the 'failed' state with result 'exit-code'.
Nov 22 08:58:08 host.borsedilussoartigianali.com systemd[1]: Failed to start The Apache HTTP Server.
░░ Subject: A start job for unit apache2.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit apache2.service has finished with a failure.
░░
░░ The job identifier is 292686 and the job result is failed.

Would you mind suggest a proper solution in order to get Apache working?

Thank you in advance.

Tried with this link but now with systemctl status apache2.service the message is:

× apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2022-11-22 09:25:51 UTC; 1min 50s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 1830565 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
        CPU: 16ms

Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: Starting The Apache HTTP Server...
Nov 22 09:25:51 host.borsedilussoartigianali.com apachectl[1830568]: apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fcgid.load: Cannot lo>
Nov 22 09:25:51 host.borsedilussoartigianali.com apachectl[1830565]: Action 'start' failed.
Nov 22 09:25:51 host.borsedilussoartigianali.com apachectl[1830565]: The Apache error log may have more information.
Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: Failed to start The Apache HTTP Server.

and with journalctl -xeu apache2.service I have:

░░ A start job for unit apache2.service has begun execution.
░░
░░ The job identifier is 292852.
Nov 22 09:24:55 host.borsedilussoartigianali.com apachectl[1830283]: apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fcgid.load: Cannot lo>
Nov 22 09:24:55 host.borsedilussoartigianali.com apachectl[1830280]: Action 'start' failed.
Nov 22 09:24:55 host.borsedilussoartigianali.com apachectl[1830280]: The Apache error log may have more information.
Nov 22 09:24:55 host.borsedilussoartigianali.com systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit apache2.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 22 09:24:55 host.borsedilussoartigianali.com systemd[1]: apache2.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit apache2.service has entered the 'failed' state with result 'exit-code'.
Nov 22 09:24:55 host.borsedilussoartigianali.com systemd[1]: Failed to start The Apache HTTP Server.
░░ Subject: A start job for unit apache2.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit apache2.service has finished with a failure.
░░
░░ The job identifier is 292852 and the job result is failed.
Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: Starting The Apache HTTP Server...
░░ Subject: A start job for unit apache2.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit apache2.service has begun execution.
░░
░░ The job identifier is 292936.
Nov 22 09:25:51 host.borsedilussoartigianali.com apachectl[1830568]: apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fcgid.load: Cannot lo>
Nov 22 09:25:51 host.borsedilussoartigianali.com apachectl[1830565]: Action 'start' failed.
Nov 22 09:25:51 host.borsedilussoartigianali.com apachectl[1830565]: The Apache error log may have more information.
Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit apache2.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: apache2.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit apache2.service has entered the 'failed' state with result 'exit-code'.
Nov 22 09:25:51 host.borsedilussoartigianali.com systemd[1]: Failed to start The Apache HTTP Server.
░░ Subject: A start job for unit apache2.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit apache2.service has finished with a failure.
░░
░░ The job identifier is 292936 and the job result is failed.

I hesitate to reply because I’m no Ubuntu expert, but my understanding is that FastCGI is deprecated everywhere in favor of PHP-FPM.

Apparently there are references to the FastCGI module, which said module doesn’t exist on your server, that are causing Apache to vomit with gusto.

However, as stated, I am no Ubuntu expert; so if one happens to drop by, ignore me and listen to them.

Richard

1 Like

Command apachectl configtest:

apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/fcgid.load: Cannot load /usr/lib/apache2/modules/mod_fcgid.so into server: /usr/lib/apache2/modules/mod_fcgid.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.

Can you post line 146 of /etc/apache2/apache2.conf and line 1 of /etc/apache2/mods-enabled/fcgid.load?

Hi

Line 146 from /etc/apache2/apache2.conf:

IncludeOptional mods-enabled/*.load

Line 1 from /etc/apache2/mods-enabled/fcgid.load:

LoadModule fcgid_module /usr/lib/apache2/modules/mod_fcgid.so

Thank you in advance.

Try commenting out both of those lines (add a # at the beginning each line), and then try to start Apache.

If it starts but the sites aren’t rendering properly, go into Virtualmin and specify PHP-FPM as the PHP execution mode for the virtual servers in question.

If it doesn’t start, then we look into it further.

Hi

cannot amend the fcgid.load from File Manager, any suggestion to do it?

Grrrr…

Okay, you need to SSH into the server and sudo to root, then use a text editor to edit the files.

If you don’t know how to use a shell text editor, then nano is probably the easiest to learn in a hurry. It’s probably included in the default install. If not:

$sudo apt install nano

At least that’s how one would do it in Debian. I assume Ubuntu is the same.

Then:

sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
sudo nano /etc/apache2/apache2.conf

Use the cursor keys to move through the file and insert the #, then CTRL-O to save. Confirm, then exit with CTRL-X.

Then the same for the second file:

sudo cp /etc/apache2/mods-enabled/fcgid.load /etc/apache2/mods-enabled/fcgid.load.bak
sudo nano /etc/apache2/mods-enabled/fcgid.load

and do the same.

Then try starting Apache.

Actually, were you logged into Virtualmin as root when you tried editing the files? I don’t recall ever being unable to edit a file unless I’d made it immutable.

Hi

instructions properly applied, both files amended, I got this message from journalctl -xeu apache2.service:

× apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2022-11-22 10:51:36 UTC; 2min 19s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 1841274 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
        CPU: 14ms

Nov 22 10:51:36 host.borsedilussoartigianali.com systemd[1]: Starting The Apache HTTP Server...
Nov 22 10:51:36 host.borsedilussoartigianali.com apachectl[1841278]: AH00534: apache2: Configuration error: No MPM loaded.
Nov 22 10:51:36 host.borsedilussoartigianali.com apachectl[1841274]: Action 'start' failed.
Nov 22 10:51:36 host.borsedilussoartigianali.com apachectl[1841274]: The Apache error log may have more information.
Nov 22 10:51:36 host.borsedilussoartigianali.com systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Nov 22 10:51:36 host.borsedilussoartigianali.com systemd[1]: apache2.service: Failed with result 'exit-code'.
Nov 22 10:51:36 host.borsedilussoartigianali.com systemd[1]: Failed to start The Apache HTTP Server.

Moreover, please note that I don’t have the setting that you mentioned (PHP-FPM choice) under Server Configuration → PHP Options:

image

This makes no sense to me. The MPM is required and should be configured during the Apache installation.

How did this server come to be? Was it a fresh minimal install of Ubuntu followed by a Virtualmin install, or something else?

Ubuntu Linux 22.04 on which was installed Virtualmin at second stage. Please note that everything was running until yesterday.

No chance to recover? Thank you.

Oh, it probably can be fixed. Most Apache problems can be.

The thing is that I’ve never used Ubuntu, nor used Debian on a production server, nor used Ubuntu nor Debian with Virtualmin. So beyond obvious Apache errors that would apply to any OS, I’m probably not the one to fix it.

I’d leave the two edits you made in place for now because I think they’re part of the solution. But I think at this point you need someone with more experience running Virtualmin on Ubuntu. That would be pretty much anyone, as my experience is zero.

I’m like a doctor: “First, do no harm.”

Richard

Noted. The only resource I found is this.

Do you think (or anybody else) it may be useful also for Ubuntu on the basis of the logic and the syntax?

Thank you.

Well… as the linked article said, that would enable a deprecated execution mode that you probably don’t want to use.

If you want to try it, that’s up to you. Just make sure you enable the module corresponding to your PHP version. But you’re much better off finding out why PHP-FPM is missing and fixing that.

I’m sure that @staff has better wisdom than I do on this. Let’s give them a call.

Richard

1 Like

That’s not a resource, that’s a disaster. Do not, under any circumstances, enable mod_php. Ever.

mod_php has nothing to do with any of the errors you’ve shown above, and enabling it will only break things more.

It appears mod_fcgid (completely unrelated to mod_php) is not being loaded. I don’t know why that would be. Did you remove some packages? Perhaps while installing other PHP versions or something? I don’t know what the fcgid package is called on Ubuntu, but that’s what you need to check first, as it is obviously missing from your system. I don’t know how/why it would be (I’m pretty sure we depend on it, so if you don’t have it, you have to have uninstalled our stack package to get there).

As someone else mentioned, PHP-FPM is preferred in modern systems, but if you installed using the Virtualmin 6 installer, you’d probably have mod_fcgid as the default execution mode (it was the preferred execution mode for several years).

mod_php has never been the preferred execution mode in a Virtualmin environment, and you have no reason to ever use it, install it, or enable it. It will lead to breakage of your sites and your apache configuration.

Edit: Package name you need to check is libapache2-mod-fcgid. It looks like you’ve uninstalled it, or deleted some files from that package.

Oh, wait, I see this has evolved past the initial errors.

What the heck did you do to your Apache? It can’t load any modules?!?

Hey Joe

everything was working like a charme until yesterday.

Just done:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  libapache2-mod-fcgid
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 64.9 kB of archives.
After this operation, 242 kB of additional disk space will be used.
Get:1 https://mirror.hetzner.com/ubuntu/packages jammy/universe amd64 libapache2                                                                                                                               -mod-fcgid amd64 1:2.3.9-4 [64.9 kB]
Fetched 64.9 kB in 0s (724 kB/s)
Selecting previously unselected package libapache2-mod-fcgid.
(Reading database ... 146699 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-fcgid_1%3a2.3.9-4_amd64.deb ...
Unpacking libapache2-mod-fcgid (1:2.3.9-4) ...
Setting up libapache2-mod-fcgid (1:2.3.9-4) ...
apache2_invoke fcgid: already enabled
apache2_reload: Your configuration is broken. Not restarting Apache 2
apache2_reload: AH00534: apache2: Configuration error: No MPM loaded.

Would you mind telling me if it is possible recover apache2 or maybe I have to uninstall and then install it once again?

Thank you in advance.

So, you did uninstall it.

I guess you uninstalled other parts of your Apache, too, as mpm is also missing. But, here’s the problem: I don’t know how you could possibly have removed that, because I think that’s in one of the core Apache packages (I think it’s in apache2-bin).