Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accidentally deleted /var/log/apache2 and now can't restart apache [closed]

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.
like image 588
Anthony Avatar asked Jun 13 '16 18:06

Anthony


People also ask

Where is Apache error log Ubuntu?

If you are troubleshooting a Debian or Ubuntu derived system, examine /var/log/apache2/error. log for errors using a tool like tail or less . For example, to view the last two lines of the error log using tail , run the following command: sudo tail -n 2 /var/log/apache2/error.

How do I view Apache logs in Ubuntu?

You can access Apache logs from var/log/log_type. For example, you can access Apache logs from the Apache Unix/Linux server by looking in the following directories: /var/log/apache/access. log.


2 Answers

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
like image 173
Anthony Avatar answered Oct 20 '22 09:10

Anthony


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.

like image 24
Reiner Gothe Avatar answered Oct 20 '22 07:10

Reiner Gothe