I'm running Apache, CentOS 5.5, cPanel.
I want to block the error_log files from being accessed from the web, as it shows errors that might give away data that I don't want given away.
How can I do this?
I'm running Apache, CentOS 5.5, cPanel.
I want to block the error_log files from being accessed from the web, as it shows errors that might give away data that I don't want given away.
How can I do this?
The answer to this is your server error_log file is not stored in the same directory tree as your webserver content files. For example, your webserver typically serves files from somewhere like /var/www
, while it writes logfiles in /var/log/httpd
. The configuration of the webserver is such that it could never access the logfiles and make them available on the web.
EDIT: responding to comment that logs may be accessible for the webserver to send to clients. In reviewing httpd.conf, this is certainly technically possible. If your DocumentRoot and ServerRoot point to the same filesystem tree, I suppose that you could end up being able to serve error_log to clients. Also if you use an absolute path for ErrorLog you could place it in under your DocumentRoot and again make it accessible to clients.
In either of those cases, you could then protect your error_log with a .htaccess file in the same directory, with contents like this:
<files error_log>
order allow,deny
deny from all
</files>
then any client that requested that file woud be denied.