O reinício do Apache2 falha a menos que eu comente linhas de log de erros - Ubuntu 16.04

1

Eu estava lutando para fazer o Apache2 reiniciar depois de habilitar meu site até que eu tropecei neste post: O reinício do Apache2 falhou no Ubuntu 16.04 onde experimentei uma das soluções listadas nos comentários que sugeriam comentar as duas linhas de log.

Eu fiz isso e agora o Apache2 é iniciado novamente, mas estou preocupado que meus arquivos de log não serão mais recodificados onde eu quero. Por que o apache não funciona quando as linhas de log não são comentadas?

Veja abaixo minha configuração atual com linhas de log comentadas:

        DocumentRoot /var/www/html/example.com/public_html
    <Directory />
            Options FollowSymLinks
            AllowOverride All
            Order Deny,Allow
            Deny from All
    </Directory>
    <Directory /var/www/html/example.com/public_html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            allow from all
    </Directory>

    #ErrorLog /var/www/html/example.com/log/error.log
    #CustomLog /var/www/html/example.com/log/access.log combined

Quando as linhas não são comentadas, recebo o seguinte erro:

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

Quando executo "systemctl status apache2.service", recebo o seguinte:

● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) (Result: exit-code) since Tue 2017-01-24 10:08:36 EST; 1h 29min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 23552 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 28665 ExecReload=/etc/init.d/apache2 reload (code=exited, status=1/FAILURE)
  Process: 28148 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/apache2.service
           ├─28163 /usr/sbin/apache2 -k start
           ├─28513 /usr/sbin/apache2 -k start
           ├─28514 /usr/sbin/apache2 -k start
           ├─28515 /usr/sbin/apache2 -k start
           ├─28516 /usr/sbin/apache2 -k start
           ├─28517 /usr/sbin/apache2 -k start
           └─28524 /usr/sbin/apache2 -k start

Jan 24 11:34:43 kbo1.kidbo.co apache2[28665]:  * Reloading Apache httpd web server apache2
Jan 24 11:34:43 drop1.example.com apache2[28665]:  *
Jan 24 11:34:43 drop1.example.com apache2[28665]:  * The apache2 configtest failed. Not doing anything.
Jan 24 11:34:43 drop1.example.como apache2[28665]: Output of config test was:
Jan 24 11:34:43 drop1.example.com apache2[28665]: (2)No such file or directory: AH02291: Cannot access directory '/var/www/html/example.com/log/' for error log of vhost defined at /etc/apache2/sites-enabled/example.com.conf:1
Jan 24 11:34:43 drop1.example.com apache2[28665]: AH00014: Configuration check failed
Jan 24 11:34:43 drop1.example.com apache2[28665]: Action 'configtest' failed.
Jan 24 11:34:43 drop1.example.com apache2[28665]: The Apache error log may have more information.
Jan 24 11:34:43 drop1.example.com systemd[1]: apache2.service: Control process exited, code=exited status=1
    
por Robert 24.01.2017 / 17:22

1 resposta

0

A saída de systemctl status apache2.service contém a próxima mensagem de erro:

Jan 24 11:34:43 drop1.example.com apache2[28665]: (2)No such file or directory: AH02291: Cannot access directory '/var/www/html/example.com/log/' for error log of vhost defined at /etc/apache2/sites-enabled/example.com.conf:1

Isso significa que você precisa criar o diretório de log desejado, ele simplesmente não existe.

sudo mkdir /var/www/html/example.com/log/
sudo systemctl restart apache2.service
    
por pa4080 24.01.2017 / 17:50