使用倾斜时,出现以下问题:没有这样的文件或目录:AH02291:无法访问目录'/ var / log / apache2 /'
Dockerfile基于php:7.4-apache
映像
运行倾斜
时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.
我的 000-default.conf 文件
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
在 Dockerfile 中也尝试了添加(www-data:www-data和root:root)
RUN mkdir -p /var/log/apache2 && \
chmod 700 /var/log/apache2 && \
chown -Rf root:root /var/log/apache2
我也尝试过
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/1 /var/log/apache2/error.log
在 docker容器
中运行并检查$ 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
查看 docker日志
时$ 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
更新
通过将ErrorLog放在<VirtualHost>
之外的问题已解决