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>