0

Apache2 is not working when I try to reload the Apache2 error msg is coming. I am very new to server and Apache2 could you please help to run the apache2. Below is the error code.

:/etc/apache2/sites-available# sudo service apache2 reload
 * Reloading web server apache2                                                                                                   *
 * The apache2 configtest failed. Not doing anything.
Output of config test was:
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost define                          d at /etc/apache2/sites-enabled/test.conf:1
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost define                          d at /etc/apache2/sites-enabled/000-default.conf:1
AH00014: Configuration check failed
Action 'configtest' failed.
The Apache error log may have more information.
1
(20)Not a directory: AH02291: Cannot access directory '/var/log/apache2/' 

Check if /var/log/apache2 directory exists and Apache has read-write access to it.

9
  • there is /var/log/ as a directory inside there is a file called apache2 – Nisha Jan 4 '17 at 13:28
  • /etc/apache2 directory is available – Nisha Jan 4 '17 at 13:29
  • /var/log/apache2 must be a directory that the user apache runs under has read-write access to. Remove or rename the file 'apache2' and make a directory. – Soren A Jan 4 '17 at 13:54
  • now i have made a directory then i tried to reload the apache2. {sudo service apache2 reload} ia m getting error [ * Reloading web server apache2 * * Apache2 is not running ] – Nisha Jan 4 '17 at 13:59
  • Then you have to start it instead: 'sudo service apache start' – Soren A Jan 4 '17 at 14:01
1

If there is no folder /var/log/apache2/ Apache will not be able to write logs there.

So create it first mkdir /var/log/apache2 , or change log folder in apache.conf to something different.

Be sure that permissions are correct as well. chmod 750 /var/log/apache2

1
  • I have tried to create the directory but is saying {mkdir: cannot create directory ‘/var/log/apache2’: File exists } – Nisha Jan 4 '17 at 13:55

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.