7

I'm using Ubuntu 14.04 and apache2 and ispconfig 3. Just a few hours ago I accidentally deleted /var/log/apache2 folder include files, now my server can't restart apache2, how can I restore them? or is that log folder and file will auto create by system, when reboot server?

When I restart apache2

 * Restarting web server apache2                                         [fail]
 * The apache2 configtest failed.
Output of config test was:
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/000-ispconfig.conf:61
(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /etc/apache2/sites-enabled/000-default.conf:1
AH00014: Configuration check failed
Action 'configtest' failed.
The Apache error log may have more information.
halfer
  • 19,824
  • 17
  • 99
  • 186
Anthony
  • 415
  • 1
  • 3
  • 12
  • 1
    Try creating that empty directory and give write permissions. `mkdir -p /var/log/apache2/` `chmod -R 755 /var/log/apache2/` – Gangaraju Jun 13 '16 at 19:15
  • Thanks Gangaraju! I found a way,thanks anyway – Anthony Jun 13 '16 at 19:24
  • 2
    Please do not add "urgent" or "please help" to your questions - there is no need to beg, and it's worth noting that this won't do anything to hurry the volunteers that answers questions here. – halfer Jun 13 '16 at 19:49
  • I would like to thanks the volunteers here , i think stackoverflow is the place for find knowledge and exchange of knowledge,no one is obliged to answer questions,but also not say just google it can solve the question,i don't know who give me negative points,but it's really remind me stackoverfow is not a really 100% for knowledge place,really thanks for who give me give me the last negative point. – Anthony Jun 13 '16 at 20:49

2 Answers2

20

Fixed!

sudo mkdir /var/log/apache2/
sudo touch /var/log/apache2/{access,error,other_vhosts_access,suexec}.log
sudo chown -R root:adm /var/log/apache2/
sudo chmod -R 750 /var/log/apache2
Anthony
  • 415
  • 1
  • 3
  • 12
  • 2
    Thanks, This works for me. but i have to run these whenever i start my system. is there any permanent solution for this ? – Bhagchandani Sep 16 '18 at 06:11
  • @user3888958 Perhaps you deleted the unused file (such as: log file, cache, etc). It also happens to me after I run Stacer to clean cache files. I know it's kinda fool not to read what would Stacer delete. – ibnɘꟻ Jan 06 '19 at 12:27
1

No changes required. I have only added tmpfs /var/log/apache2 tmpfs defaults,noatime 0 0 in /etc/fstab. Then restart computer. And fix it on my Ubuntu 16.04.

Sagar Kodte
  • 3,723
  • 4
  • 23
  • 52