5

When I run sudo service apache2 start I get this error:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

And when I run systemctl status apache2.service I get this:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-01-15 16:20:26 -03; 7min ago
  Process: 8101 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

ene 15 16:20:26 pc systemd[1]: Starting The Apache HTTP Server...
ene 15 16:20:26 pc apachectl[8101]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. 
ene 15 16:20:26 pc apachectl[8101]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
ene 15 16:20:26 pc apachectl[8101]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost 
ene 15 16:20:26 pc apachectl[8101]: AH00014: Configuration check failed
ene 15 16:20:26 pc apachectl[8101]: Action 'start' failed.
ene 15 16:20:26 pc apachectl[8101]: The Apache error log may have more information.
ene 15 16:20:26 pc systemd[1]: apache2.service: Control process exited, code=exited status=1
ene 15 16:20:26 pc systemd[1]: apache2.service: Failed with result 'exit-code'.
ene 15 16:20:26 pc systemd[1]: Failed to start The Apache HTTP Server.

What can I do about this?

10
  • 2
    The message is pretty clear: Cannot access directory '/var/log/apache2/'. Does that directory exist and is writable by the www-data user? What does ls -ld /var/log/apache2 show?
    – PerlDuck
    Jan 15, 2019 at 19:51
  • It complains about that it can't access '/val/log/apache2` ..does it exist ?
    – Soren A
    Jan 15, 2019 at 19:52
  • 1
    That is weird because /var/log should contain at least a dozen or so logfiles. What Ubuntu version do you have?
    – PerlDuck
    Jan 15, 2019 at 20:07
  • 1
    no, but I tried to clean my system with stacer, maybe that deleted my logfiles Jan 15, 2019 at 20:20
  • 1
    Yes, stacer deleted my logfiles, shoud I just create that empty directory and give it write permissions? Jan 15, 2019 at 20:24

1 Answer 1

11

Fixed

I just created the directory and gave it write permissions:

sudo mkdir -p /var/log/apache2/
sudo chmod -R 744 /var/log/apache2/
3
  • 1
    Is there a reason why not give it 744 permissions instead ?
    – bistoco
    Jan 22, 2019 at 20:42
  • I'm kind of new at this, what's the difference between 744 and 755? Jan 23, 2019 at 22:19
  • 1
    this may help you
    – bistoco
    Jan 24, 2019 at 20:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .