apache error and access logs are missing, what could be the cause and how can I recreate them?
Solution 1:
When path references in an Apache configuration are not absolute (i.e. don't start with /
) they are relative to the directory set in the ServerRoot
directive. A common default for the ServerRoot
is /etc/httpd
making /etc/httpd/logs
your log directory.
Most packaged Apache versions create a symbolic link from /etc/httpd/logs
to /var/log/httpd
. Either the actual directory in /etc/httpd is missing (or the root filesystem is full) or the symbolic link may be missing in your setup.
Apache gets started by root and opens the log files as root before dropping privileges so those directory permissions on /var/log/httpd seem correct.
Solution 2:
My problem was that there was no Log directive for the access log. I followed the instructions here https://ubuntuforums.org/showthread.php?t=1704686 which basically says:
On ubuntu, you're supposed to have a file named /etc/apache2/conf.d/other-vhosts-access-log
with the following contents:
# Define an access log for VirtualHosts that don't define their own logfile
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
I was missing this, which is why I didn't get the logs.