2016-06-13 121 views
2

我使用的是Ubuntu 14.04和apache2以及ispconfig 3.就在几小时前我意外删除了/ var/log/apache2文件夹包含文件,现在我的服务器无法重新启动apache2,我该如何恢复它们?或者是当重新启动服务器时,系统会自动创建日志文件夹和文件?意外删除/ var/log/apache2现在无法重新启动apache

当我重新启动的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. 
+0

尝试创建该空目录并给予写入权限。 'mkdir -p/var/log/apache2 /''chmod -R 755/var/log/apache2 /' – Gangaraju

+0

感谢Gangaraju!我发现了一种方法,无论如何感谢 – Anthony

+2

请不要在您的问题中加上“紧急”或“请帮助” - 不需要乞求,值得注意的是,这不会让任何问题的志愿者在这里回答问题。 – halfer

回答

7

固定!

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 
1

无需更改。 我只在/etc/fstab中添加了tmpfs /var/log/apache2 tmpfs defaults,noatime 0 0。然后重启电脑。并修复它在我的Ubuntu 16.04上。