accidentally deleted /var/log/apache2 and now can't restart apache

Discussion in 'General' started by anthonywang, Jun 13, 2016.

  1. anthonywang

    anthonywang Member

    I'm using ubuntu 14.04 and apache2 and ispconfig 3,just few minutes 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?
    i'm using Filezilla

    Many thanks to all well-intentioned people!
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Login with ssh, then try:
    Code:
    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 750 /var/log/apache2/
    sudo chmod 640 /var/log/apache2/*.log
    If it still won't start, post the exact error.
     
    Last edited: Jun 13, 2016
    anthonywang likes this.
  3. anthonywang

    anthonywang Member

    Jesse You are my God!it's working now!
    many thanks!!!!
    after this,
    Is there anything I have to pay attention to in log/apache2 files?like edit something or?

    Here is ssh message before fixed it:
    Code:
    * 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.
    
     
    Last edited: Jun 13, 2016
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    There's probably nothing more to do, unless you see something complaining about a missing file there. Even if they don't exist, log files are often created automatically; the entire directory they're found in is a different matter though, and would usually need recreated manually.
     
  5. anthonywang

    anthonywang Member

    I got it,thanks Jesse!
     

Share This Page