[ Team LiB ] |
Recipe 4.9 Logging for Each Virtual HostProblemYou want each virtual host to have its own logfiles. SolutionSpecify Errorlog and CustomLog within each virtual host declaration: <VirtualHost *> ServerName waldo.example.com DocumentRoot /home/waldo/www/htdocs ErrorLog /home/waldo/www/logs/error_log CustomLog /home/waldo/www/logs/access_log combined </VirtualHost> DiscussionThe various logging directives can be placed either in the main body of your configuration file or within a <VirtualHost> section. When it is placed within a virtual host, log entries for that virtual host go in the specified logfile, rather than into the log file(s) defined in the main server configuration.
In the recipe given here, the logfiles are placed within the home directory of a particular user, rather than in the main log directory. This gives you easier access to those files, but you still need to take adequate precautions to set the permissions on the directory in question. Consult Chapter 6 for a discussion on file permissions. See Also |
[ Team LiB ] |