4

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?

9
  • 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 '19 at 19:51
  • It complains about that it can't access '/val/log/apache2` ..does it exist ? – Soren A Jan 15 '19 at 19:52
  • /var/log/ is empty – Fernando Liévano Jan 15 '19 at 19:53
  • 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 '19 at 20:07
  • Please don't ask more unrelated questions in same question. Create a new question for the second one. – Soren A Jan 15 '19 at 20:07
7

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 '19 at 20:42
  • I'm kind of new at this, what's the difference between 744 and 755? – Fernando Liévano Jan 23 '19 at 22:19
  • 1
    this may help you – bistoco Jan 24 '19 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.