2016-06-13 119 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上。