Reputation: 101
ok guys, im stumped. I install centos 7.2 on a vm, installed httpd, enabled it as a service, then started it then created and edited a config file as follows
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.mydomain.com
ServerAlias mydomain.com
DocumentRoot /var/www/mydomain.com/public_html
#ErrorLog /var/www/mydomain.com/error.log
#CustomLog /var/www/mydomain.com/requests.log combined
</VirtualHost>
So.. When I uncomment the "ErrorLog", which I believe is correct, and there is a file called error.log in directory "/var/www/mydomain.com/" Httpd.service doesn't want to start, with the error:
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/mydomain.com/error.log.
AH00015: Unable to open logs
I tried doing chown on the error.log file, to apache:apache, and root:root, and the user for the site, but that didn't work. I also made sure to 755 the directory for www, so the error.log file should be able to be opened by that. Help me out please
Upvotes: 3
Views: 10598
Reputation: 101
Turns out that the error and access logs needed to be placed in /var/log/httpd/ instead of where they were.
Upvotes: 6
Reputation: 184
All the directories in the path leading up to the error.log must have the executable and readable bit set for the apache user or group, in order for apache to be able to write to the log file.
In order to debug the permissions, you could su to the apache user, and try touching the file:
sudo -u apache touch /var/www/mydomain.com/error.log
Upvotes: -1