意外删除/ var/log/apache2现在无法重启apache

Ant*_*ony 6 ubuntu filezilla apache2 ispconfig

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

当我重新启动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.
Run Code Online (Sandbox Code Playgroud)

Ant*_*ony 18

固定!

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
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,这对我有用。但是我每次启动系统时都必须运行这些程序。有什么永久解决方案吗? (2认同)