0

I recently installed Apache2 via sudo apt install apache2 but it doesn't seem to be working right. I get this error when I try to restart the service using sudo /etc/init.d/apache2 restart. I'm using Kubuntu 18.04.1 64-bit.

-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has begun starting up.
Aug 29 13:31:47 alpaca-desktop apachectl[10871]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' di
Aug 29 13:31:47 alpaca-desktop apachectl[10871]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
Aug 29 13:31:47 alpaca-desktop apachectl[10871]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /etc/apache2
Aug 29 13:31:47 alpaca-desktop apachectl[10871]: AH00014: Configuration check failed
Aug 29 13:31:47 alpaca-desktop apachectl[10871]: Action 'start' failed.
Aug 29 13:31:47 alpaca-desktop apachectl[10871]: The Apache error log may have more information.
Aug 29 13:31:47 alpaca-desktop systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 29 13:31:47 alpaca-desktop systemd[1]: apache2.service: Failed with result 'exit-code'.
Aug 29 13:31:47 alpaca-desktop systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has failed.
-- 
-- The result is RESULT.

1 Answer 1

1

This is the reason:

(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log

If that directory doesn't exist, then how can Apache start? And if it does, then the user designated for Apache can't access it, which means the file permissions are incorrect.

7
  • mkdir: cannot create directory ‘/var/log/apache2’: File exists Commented Aug 29, 2018 at 19:17
  • Ok, well maybe try moving that file elsewhere and creating a directory. I would check to see if there is any contents in the file first.. Commented Aug 29, 2018 at 19:22
  • I purged and re-installed apache2 and the problem changed, now it's saying that it can't bind to address because the address is already in use. Should I post a separate question? These seem like separate issues. Commented Aug 29, 2018 at 19:28
  • Just kill the PID then try starting Apache.... It seems like you had it running at some point and the PID was hung.. Commented Aug 29, 2018 at 19:33
  • You running this as root or atleast w/ sudo privs? If not, netstat will not provide the PID that is binding to port 80. From the looks of it, something is in fact binding to port 80. Commented Aug 29, 2018 at 19:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.