Symptoms
- Apache was updated to 2.4.18-2ubuntu3.18 version on Ubuntu 16:
# dpkg -l | grep apache
ii apache2 2.4.18-2ubuntu3.18 amd64 Apache HTTP Server
ii apache2-bin 2.4.18-2ubuntu3.18 amd64 Apache HTTP Server (modules and other binary files)
ii apache2-data 2.4.18-2ubuntu3.18 all Apache HTTP Server (common files)
ii apache2-doc 2.4.18-2ubuntu3.18 all Apache HTTP Server (on-site documentation)
ii apache2-utils 2.4.18-2ubuntu3.18 amd64 Apache HTTP Server (utility programs for web servers) - Apache is down and can not be started:
# service apache2 status
● apache2.service – LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
….
Dec 02 08:56:52 vnascimento.ubuntu-16.04 apache2[9554]: Invoking ‘systemctl start ‘.
Dec 02 08:56:52 vnascimento.ubuntu-16.04 apache2[9554]: Use ‘systemctl status ‘ for more info.
Dec 02 08:56:52 vnascimento.ubuntu-16.04 apache2[9554]: Failed to mangle name: Invalid argument
Dec 02 08:56:52 vnascimento.ubuntu-16.04 apache2[9554]: Failed to expand names: Invalid argument
Dec 02 08:56:52 vnascimento.ubuntu-16.04 apache2[9554]: Action ‘start’ failed. - Sites show
502 Bad Gateway
- Unable to repair webserver configuration files for domain:
# plesk repair web example.com -y
Error: Can not reconfigure web server configurations: Unable to execute httpdmng: [2020-11-29 18:29:49.780] ERR [util_exec] proc_close() failed [‘/opt/psa/admin/bin/apache_control_adapter’ ‘–restart’ ‘–restart-interval’ ‘0’ ‘–http-port’ ‘7080’ ‘–https-port’ ‘7081’] with exit code [255]
[2020-11-29 18:29:50.303] ERR [panel] Apache config (16066744630.19908600) generation failed: Template_Exception: Can not restart web server:
Cause
Apache installed from non default repositories causes the issue.
Resolution
-
Connect to the server via SSH.
- Create backup of
/etc/apt/sources.list
.# cp -p /etc/apt/sources.list /etc/apt/sources.list_bk
- Remove everything from
/etc/apt/sources.list
and add below default repository URL’s to this file:deb http://archive.ubuntu.com/ubuntu xenial main restricted universe
deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted universe
deb http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu xenial partner - Update dependencies:
# apt-get update
- Downgrade Apache:
# apt-get install apache2=2.4.18-2ubuntu3.17 apache2-data=2.4.18-2ubuntu3.17 apache2-bin=2.4.18-2ubuntu3.17 apache2-utils=2.4.18-2ubuntu3.17
- Install and upgrade packages:
# apt-get upgrade
- Restart Apache:
# service apache2 restart