1

When using tilt I get the following issue: No such file or directory: AH02291: Cannot access directory '/var/log/apache2/'

Dockerfile is based on the php:7.4-apache image

When running Tilt up

ERROR:
(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:4
AH00014: Configuration check failed                                                                                                                                                                                           
Action '-D FOREGROUND' failed.

My 000-default.conf file

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

### I also tried the below ###

ErrorLog /dev/stderr
CustomLog /dev/stdout combined

In Dockerfile also added (www-data:www-data and root:root) both tried

RUN mkdir -p /var/log/apache2 && \
    chmod 700 /var/log/apache2 && \
    chown -Rf root:root /var/log/apache2

and I also tried

RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
    ln -sf /proc/self/fd/1 /var/log/apache2/error.log

Running and checking inside the docker container

$ cd /var/log/apache2
$ ls -al
lrwxrwxrwx 1 root root   11 May 15 12:49 access.log -> /dev/stdout
lrwxrwxrwx 1 root root   11 May 15 12:49 error.log -> /dev/stderr
lrwxrwxrwx 1 root root   11 May 15 12:49 other_vhosts_access.log -> /dev/stdout

When checking docker logs

$ docker logs <container>
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.4. Set the 'ServerName' directive globally to suppress this message
[Sat Jun 13 14:49:10.457151 2020] [ssl:warn] [pid 7] AH01906: 172.19.0.4:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sat Jun 13 14:49:10.457275 2020] [ssl:warn] [pid 7] AH01909: 172.19.0.4:443:0 server certificate does NOT include an ID which matches the server name

UPDATE

Resolved issue by placing ErrorLog outside <VirtualHost>

Tony Clemmey
  • 21
  • 1
  • 1
  • 6
  • Possible answer for your problem is in this [link](https://stackoverflow.com/questions/46266527/could-not-reliably-determine-the-servers-fully-qualified-domain-name-how-to) – Ashfaq Raj Jun 13 '20 at 17:03
  • Hey, @AshfaqRaj thanks for the reply and link. What actually resolved this for me was to place the ErrorLog outside the Vhost instead of inside the Vhost. While docker would run and build, TIlt would not. – Tony Clemmey Jun 14 '20 at 14:18

0 Answers0