# Apache2.service failed because

**URL:** <https://help.nextcloud.com/t/apache2-service-failed-because/58642>\
**Category:** ℹ️ Support\
**Created:** [August 21, 2019, 5:40pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642 "2019-08-21T17:40:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lockslay](https://help.nextcloud.com/letter_avatar/lockslay/32/5_5575768a8748004e209b776fc1b2916d.png) [@Lockslay](https://help.nextcloud.com/u/Lockslay)\
**Post date:** [August 21, 2019, 5:40pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/1 "2019-08-21T17:40:18Z")

</div>

ssh Login:

NextCloudPi v1.16.0 is up to date  
Update to buster available. Type ‘sudo ncp-dist-upgrade’ to upgrade  
Last login: Wed Aug 21 19:01:23 2019 from 192.168.0.28

sudo ncp-dist-upgrade

Job for apache2.service failed because the control process exited with error code.  
See “systemctl status apache2.service” and “journalctl -xe” for details.  
Something went wrong. Fix it and try again

pi@nextcloudpi:~ $ sudo systemctl reload apache2  
apache2.service is not active, cannot reload.  
pi@nextcloudpi:~ $ sudo service apache2 start  
Job for apache2.service failed because the control process exited with error code.  
See “systemctl status apache2.service” and “journalctl -xe” for details.  
pi@nextcloudpi:~ $ systemctl status 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 Wed 2019-08-21 19:34:45 CEST; 48s ago  
Docs: [https://httpd.apache.org/docs/2.4/](https://httpd.apache.org/docs/2.4/)  
Process: 2274 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Aug 21 19:34:45 nextcloudpi systemd[1]: Starting The Apache HTTP Server…  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: AH00526: Syntax error on line 1 of /etc/apac  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: Invalid command ‘Alias’, perhaps misspelled  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: Action ‘start’ failed.  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: The Apache error log may have more informati  
Aug 21 19:34:45 nextcloudpi systemd[1]: apache2.service: Control process exited, code=exi  
Aug 21 19:34:45 nextcloudpi systemd[1]: apache2.service: Failed with result ‘exit-code’.  
Aug 21 19:34:45 nextcloudpi systemd[1]: Failed to start The Apache HTTP Server.  
lines 1-14/14 (END)…skipping…  
● apache2.service - The Apache HTTP Server  
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)  
Active: failed (Result: exit-code) since Wed 2019-08-21 19:34:45 CEST; 48s ago  
Docs: [https://httpd.apache.org/docs/2.4/](https://httpd.apache.org/docs/2.4/)  
Process: 2274 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Aug 21 19:34:45 nextcloudpi systemd[1]: Starting The Apache HTTP Server…  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: AH00526: Syntax error on line 1 of /etc/apache2/conf-enabled/javascript-common.conf:  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: Invalid command ‘Alias’, perhaps misspelled or defined by a module not included in the server configuration  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: Action ‘start’ failed.  
Aug 21 19:34:45 nextcloudpi apachectl[2274]: The Apache error log may have more information.  
Aug 21 19:34:45 nextcloudpi systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE  
Aug 21 19:34:45 nextcloudpi systemd[1]: apache2.service: Failed with result ‘exit-code’.  
Aug 21 19:34:45 nextcloudpi systemd[1]: Failed to start The Apache HTTP Server.

I have a problem with my cloud after the update, Can someone help me here?

---

<div class="post-metadata">

**Author:** ![mactrent](https://help.nextcloud.com/letter_avatar/mactrent/32/5_5575768a8748004e209b776fc1b2916d.png) [@mactrent](https://help.nextcloud.com/u/mactrent)\
**Post date:** [August 21, 2019, 7:19pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/2 "2019-08-21T19:19:21Z")

</div>

> [@Lockslay](#):
>
> Aug 21 19:34:45 nextcloudpi apachectl[2274]: Invalid command ‘Alias’, perhaps misspelled or defined by a module not included in the server configuration

This makes me think that Apache’s mod\_alias isn’t enabled right now. Assuming it’s installed, you should be able to enable it with the following command:  
`a2enmod alias`

Then try to restart Apache:  
`systemctl start apache2`

---

<div class="post-metadata">

**Author:** ![Lockslay](https://help.nextcloud.com/letter_avatar/lockslay/32/5_5575768a8748004e209b776fc1b2916d.png) [@Lockslay](https://help.nextcloud.com/u/Lockslay)\
**Post date:** [August 25, 2019, 7:13pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/3 "2019-08-25T19:13:00Z")

</div>

> [@mactrent](#):
>
> a2enmod alias

Hello,

a2enmod alias  
Module alias already enabled

and:  
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.  
1 nicht vollständig installiert oder entfernt.  
Nach dieser Operation werden 0 B Plattenplatz zusätzlich benutzt.  
apache2 (2.4.38-3) wird eingerichtet …  
ERROR: Conf security not properly enabled: /etc/apache2/conf-enabled/security.conf is a real file, not touching it  
dpkg: Fehler beim Bearbeiten des Paketes apache2 (–configure):  
»installiertes apache2-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 1 zurück  
Fehler traten auf beim Bearbeiten von:  
apache2  
E: Sub-process /usr/bin/dpkg returned an error code (1)  
Something went wrong. Fix it and try again

sudo apt-get upgrade  
Paketlisten werden gelesen… Fertig  
Abhängigkeitsbaum wird aufgebaut.  
Statusinformationen werden eingelesen… Fertig  
Paketaktualisierung (Upgrade) wird berechnet… Fertig  
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.  
1 nicht vollständig installiert oder entfernt.  
Nach dieser Operation werden 0 B Plattenplatz zusätzlich benutzt.  
Möchten Sie fortfahren? [J/n] j  
apache2 (2.4.38-3) wird eingerichtet …  
ERROR: Conf security not properly enabled: /etc/apache2/conf-enabled/security.conf is a real file, not touching it  
dpkg: Fehler beim Bearbeiten des Paketes apache2 (–configure):  
»installiertes apache2-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 1 zurück  
Fehler traten auf beim Bearbeiten von:  
apache2  
E: Sub-process /usr/bin/dpkg returned an error code (1)

---

<div class="post-metadata">

**Author:** ![mactrent](https://help.nextcloud.com/letter_avatar/mactrent/32/5_5575768a8748004e209b776fc1b2916d.png) [@mactrent](https://help.nextcloud.com/u/mactrent)\
**Post date:** [August 27, 2019, 2:48pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/4 "2019-08-27T14:48:44Z")

</div>

Looks like the ‘apache2’ package didn’t install correctly. With Debian (or any other distribution that uses APT, such as Ubuntu), this could happen for a number of reasons. I’d recommend this command as a way to fix it, if a simple fix is possible:  
`sudo apt -f install`

Once the apache2 package is fixed, it looks like there may also be a a problem with its security configuration. I would run this and go from there:  
`apachectl configtest`

---

<div class="post-metadata">

**Author:** ![Lockslay](https://help.nextcloud.com/letter_avatar/lockslay/32/5_5575768a8748004e209b776fc1b2916d.png) [@Lockslay](https://help.nextcloud.com/u/Lockslay)\
**Post date:** [August 27, 2019, 3:56pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/5 "2019-08-27T15:56:21Z")

</div>

Hello,

sudo apt -f install  
Paketlisten werden gelesen… Fertig  
Abhängigkeitsbaum wird aufgebaut.  
Statusinformationen werden eingelesen… Fertig  
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.  
1 nicht vollständig installiert oder entfernt.  
Nach dieser Operation werden 0 B Plattenplatz zusätzlich benutzt.  
apache2 (2.4.38-3) wird eingerichtet …  
ERROR: Conf security not properly enabled: /etc/apache2/conf-enabled/security.conf is a real file, not touching it  
dpkg: Fehler beim Bearbeiten des Paketes apache2 (–configure):  
»installiertes apache2-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 1 zurück  
Fehler traten auf beim Bearbeiten von:  
apache2  
E: Sub-process /usr/bin/dpkg returned an error code (1)

apachectl configtest  
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message  
Syntax OK

sudo apt-get upgrade  
Paketlisten werden gelesen… Fertig  
Abhängigkeitsbaum wird aufgebaut.  
Statusinformationen werden eingelesen… Fertig  
Paketaktualisierung (Upgrade) wird berechnet… Fertig  
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.  
1 nicht vollständig installiert oder entfernt.  
Nach dieser Operation werden 0 B Plattenplatz zusätzlich benutzt.  
Möchten Sie fortfahren? [J/n] j  
apache2 (2.4.38-3+deb10u1) wird eingerichtet …  
ERROR: Conf security not properly enabled: /etc/apache2/conf-enabled/security.conf is a real file, not touching it  
dpkg: Fehler beim Bearbeiten des Paketes apache2 (–configure):  
»installiertes apache2-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 1 zurück  
Fehler traten auf beim Bearbeiten von:  
apache2  
E: Sub-process /usr/bin/dpkg returned an error code (1)

---

<div class="post-metadata">

**Author:** ![mactrent](https://help.nextcloud.com/letter_avatar/mactrent/32/5_5575768a8748004e209b776fc1b2916d.png) [@mactrent](https://help.nextcloud.com/u/mactrent)\
**Post date:** [August 27, 2019, 4:51pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/6 "2019-08-27T16:51:57Z")

</div>

I would try moving the /etc/apache2/conf-enabled/security.conf file elsewhere and running those commands again. Beyond that, it seems to be a Debian package issue, and I can’t help you much more on that.

---

<div class="post-metadata">

**Author:** ![CFelix](https://help.nextcloud.com/letter_avatar/cfelix/32/5_5575768a8748004e209b776fc1b2916d.png) [@CFelix](https://help.nextcloud.com/u/CFelix)\
**Post date:** [August 28, 2019, 1:24pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/7 "2019-08-28T13:24:55Z")

</div>

Hi @Lockslay,

this error looks like you moved the `security.conf` file manually from `/etc/apache2/conf-available/` to `/etc/apache2/conf-enabled/`.

Best practice is to create sym-links instead. Try the following and see if your `apt-get update; apt-get upgrade` works afterwards.

1. Move the file `security.conf`back to its original folder:

`mv /etc/apache2/conf-enabled/security.conf /etc/apache2/conf-available/`

1. Now create a sym-link to the file

`ln -s /etc/apache2/conf-available/security.conf /etc/apache2/conf-enabled/security.conf`

Now the Apt Upgrade should work without any error messages.

//EDIT: The above sym-link creation is the same what `a2enconf security` would do, just wanted to add that for future reference.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 10:18am UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/8 "2024-12-04T10:18:53Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 3:30pm UTC](https://help.nextcloud.com/t/apache2-service-failed-because/58642/9 "2024-12-11T15:30:01Z")

</div>


