I am running apache2 2.4.10
in a debian docker container using below docker-compose file:
version: '3.8'
services:
apache2-php:
container_name: apache2-php-container
image: apache2-php-image
build:
context: ./docker/apache2
ports:
- "8082:80"
volumes:
- ./docker/apache2/index.php:/var/www/index.php
with this site.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName localhost
ServerAlias localhost
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Its up an running just fine but for some reason logs are written to stdout/stderr instead of above specified files. Also I see:
$ ls -la /var/log/apache2
total 8
drwxrwxrwx 2 www-data www-data 4096 Dec 29 2018 .
drwxr-xr-x 1 root root 4096 Dec 29 2018 ..
lrwxrwxrwx 1 www-data www-data 11 Dec 29 2018 access.log -> /dev/stdout
lrwxrwxrwx 1 www-data www-data 11 Dec 29 2018 error.log -> /dev/stderr
lrwxrwxrwx 1 www-data www-data 11 Dec 29 2018 other_vhosts_access.log -> /dev/stdout
Do I need to add some option in my site to force apache2 to write to the actual files instead of to stdout/stderr?
For some reason those are symlinks to the device files for stdout and stderr. To make Apache write to actual files, you simply need to remove the symlinks and restart Apache: