This page is now depreciated - please see new Apache pages
There are two ways to ensure your logs get rotated...
- logrotate - The standard, cross application log rotation solution. Its very reliable and easy to configure, but requires that Apache is restarted every time your log is rotated so that it follows the log switch around.
- rotatelog pipe - Has more overhead as logs are piped to a child process to handle, but doesn't require Apache restarts.
Edit you existing config file to redirect logging through the child rotatelogs process, this will probably be found in either your site config (EG in
/etc/apache2/sites-enabled) or your Apache service config (EG in
ErrorLog "|/usr/sbin/rotatelogs /var/log/apache2/error-%Y-%m-%d.log 86400" CustomLog "|/usr/sbin/rotatelogs /var/log/apache2/access-%Y-%m-%d.log 86400" combined
Check that the path for
rotatelogs is correct (search using
find / -iname rotatelogs )
Restart Apache, perform a test page load on your site (that would generate log entries), and check that a log file has been generated as per your config
- Create a user/pass entry in a file for a username
htpasswd -c /usr/local/apache2/conf/htusers username
- Add the relavent bits to the
AuthName "Restricted Access"
- Restart the apache service
service apache2 restart
NameVirtualHost *:80 has no VirtualHosts
On restarting Apache you get presented with the following warning
[Thu Jan 12 10:58:20 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
This is generally caused by duplicate
NameVirtualHost entries in your config.
Perform the following in
/etc/apache2 folder to identify where the entries and delete the unwanted duplicates..
grep NameVir * -R