0

I wanted to restart my server so I did :

sudo service apache2 restart

It instead showed me the message below :

Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.

I then did systemctl -l status apache2.service and it came out with these results:

    apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─forking.conf
   Active: failed (Result: exit-code) since Thu 2016-12-15 07:44:48 CST; 43min ago
  Process: 31239 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Dec 15 07:44:48 s87890 apache2[31239]: Starting web server: apache2 failed!
Dec 15 07:44:48 s87890 apache2[31239]: The apache2 configtest failed. ... (warning).
Dec 15 07:44:48 s87890 apache2[31239]: Output of config test was:
Dec 15 07:44:48 s87890 apache2[31239]: apache2: Syntax error on line 216 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf-enabled/softaculous.conf: No such file or directory
Dec 15 07:44:48 s87890 apache2[31239]: Action 'configtest' failed.
Dec 15 07:44:48 s87890 apache2[31239]: The Apache error log may have more information.
Dec 15 07:44:48 s87890 systemd[1]: apache2.service: control process exited, code=exited status=1
Dec 15 07:44:48 s87890 systemd[1]: Failed to start LSB: Apache2 web server.
Dec 15 07:44:48 s87890 systemd[1]: Unit apache2.service entered failed state.

I looked at line 216 of /etc/apache2/apache2.conf and this is what I saw:

IncludeOptional conf-enabled/*.conf

I did journalctl -xn and it showed me :

    - Logs begin at Tue 2016-12-13 16:17:11 CST, end at Thu 2016-12-15 08:11:24 CST. --
Dec 15 08:11:05 s87890 sshd[32074]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.48  user=root
Dec 15 08:11:07 s87890 sshd[32074]: Failed password for root from 116.31.116.48 port 61622 ssh2
Dec 15 08:11:10 s87890 sshd[32074]: Failed password for root from 116.31.116.48 port 61622 ssh2
Dec 15 08:11:12 s87890 sshd[32074]: Failed password for root from 116.31.116.48 port 61622 ssh2
Dec 15 08:11:12 s87890 sshd[32074]: Received disconnect from 116.31.116.48: 11:  [preauth]
Dec 15 08:11:12 s87890 sshd[32074]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.48  user=root
Dec 15 08:11:22 s87890 postfix/smtpd[32032]: warning: hostname dedic858.hidehost.net does not resolve to address 91.200.13.20: Name or service not kn
Dec 15 08:11:22 s87890 postfix/smtpd[32032]: connect from unknown[91.200.13.20]
Dec 15 08:11:24 s87890 sudo[32065]: ejandra : TTY=pts/0 ; PWD=/home/ejandra ; USER=root ; COMMAND=/bin/journalctl -xn
Dec 15 08:11:24 s87890 sudo[32065]: pam_unix(sudo:session): session opened for user root by ejandra(uid=0)

I already did an apache uninstall and then installed it again but still the same error persists. What could be wrong here?

ejandra
  • 101
  • 2
    Try to do a 'apachectl configtest' to check if there are errors in the configuration files. – Soren A Dec 15 '16 at 13:38
  • Are you root? use sudo journalctl -xn and update your question with apache.conf and output of systemctl status apache2 use -l – janasaiarun Dec 15 '16 at 13:39
  • @janasaiarun I have made the edits, could you please help me with it? I am new to apache and really not much clue on how to further debug this one. – ejandra Dec 15 '16 at 15:01

2 Answers2

0

Have a closer look at your systemctl -l status apache2.service output. The problem is not the /etc/apache2/apache2.conf.

Dec 15 07:44:48 s87890 apache2[31239]: apache2: Syntax error on line 216 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf-enabled/softaculous.conf: No such file or directory

apache tries to include the config file /etc/apache2/conf-enabled/softaculous.conf

This could be a broken symlink. Try to disable the config with a2disconf softaculous or remove the symlink (if there is any)

0

How I figured it out :

What happened here actually is that I tried to uninstall Softaculous from ISPConfig following the instructions from their documentation. After that, I was unable to do a :

sudo service apache2 restart

The stupid thing I did next to cope with the error was uninstall then reinstall apache2 following the answer in a similar question here without checking the logs first. But then, I was still unable to restart Apache2.

So that's when I only decided to check the logs then via

sudo systemctl -l status apache2.service

It then showed me the error about not being able to open /etc/apache2/conf-enabled/softaculous.conf. I then removed the softaculous.conf in /etc/apache2/conf-enabled.

After that, new errors kept popping out about dependencies. I then realized that when I installed apache2, it was via the guide here. It is a sequential guide to installing "The Perfect Server" in Debian 8 and I thought that uninstalling apache2 on its own messed up everything.

So what I did was to follow the process again in the said guide above until I reinstalled everything. However, I was faced with another problem when I prompted sudo systemctl -l status apache2.service because I could not do a sudo service apache2 reload.It showed me the error below:

apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─forking.conf
   Active: inactive (dead) since Fri 2016-12-16 04:53:27 CST; 12min ago
  Process: 9441 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 9423 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

Dec 16 04:53:27 s87890 apache2[9423]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Dec 16 04:53:27 s87890 apache2[9423]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Dec 16 04:53:27 s87890 apache2[9423]: no listening sockets available, shutting down
Dec 16 04:53:27 s87890 apache2[9423]: AH00015: Unable to open logs
Dec 16 04:53:27 s87890 apache2[9423]: Action 'start' failed.
Dec 16 04:53:27 s87890 apache2[9423]: The Apache error log may have more information.
Dec 16 04:53:27 s87890 apache2[9423]: .
Dec 16 04:53:27 s87890 apache2[9441]: Stopping web server: apache2.
Dec 16 04:53:27 s87890 systemd[1]: Started LSB: Apache2 web server.
Dec 16 04:53:37 s87890 systemd[1]: Unit apache2.service cannot be reloaded because it is inactive.

I then figured out that Apache2 could not start because nginx is installed and using port 80. I uninstalled it by doing :

sudo apt-get remove nginx nginx-common
sudo apt-get autoremove

After that, I was able to successfully restart and reload Apache2 again.

So the lesson I learned here is not blindly follow other answers without confirming the logs first.

Thanks to everyone who helped me out especially on how to check the logs (because I am not very familiar with Apache).

ejandra
  • 101