<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.nginx.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.nginx.org/index.php?title=SeparateErrorLoggingPerVirtualHost&amp;feed=atom&amp;action=history</id>
		<title>SeparateErrorLoggingPerVirtualHost - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.nginx.org/index.php?title=SeparateErrorLoggingPerVirtualHost&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://wiki.nginx.org/index.php?title=SeparateErrorLoggingPerVirtualHost&amp;action=history"/>
		<updated>2013-05-22T14:31:29Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.0</generator>

	<entry>
		<id>http://wiki.nginx.org/index.php?title=SeparateErrorLoggingPerVirtualHost&amp;diff=299&amp;oldid=prev</id>
		<title>Admin: /* Separating error logs per virtual host */</title>
		<link rel="alternate" type="text/html" href="http://wiki.nginx.org/index.php?title=SeparateErrorLoggingPerVirtualHost&amp;diff=299&amp;oldid=prev"/>
				<updated>2009-03-15T03:46:31Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Separating error logs per virtual host&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Separating error logs per virtual host ==&lt;br /&gt;
&lt;br /&gt;
When you have multiple virtual hosts, it makes sense to keep a separate error logs for all. Virtual hosts can be completely independent, and even managed by different admins. Therefore, each should have its own access and error log. (However, [http://www.wikivs.com/wiki/Lighttpd_vs_nginx#Separated_error_logging_per_virtual_server lighttpd's author refuses to implement this feature] ).&lt;br /&gt;
&lt;br /&gt;
Here is a configuration example for separate error logging per virtual host. Note that the [[NginxHttpMainModule#error_log| error_log]]  directive has different default values depending on the section it appears in. This means that you have to explicitly set the error logging level in the [[NginxHttpCoreModule#server| server {...}]]  block.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;nginx&amp;quot;&amp;gt;&lt;br /&gt;
error_log logs/main_error.log;&lt;br /&gt;
&lt;br /&gt;
events {&lt;br /&gt;
  worker_connections 1024;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
http {&lt;br /&gt;
  error_log logs/http_error.log error;&lt;br /&gt;
  server {&lt;br /&gt;
    server_name one.org;&lt;br /&gt;
    access_log logs/one.access;&lt;br /&gt;
    error_log logs/one.error error;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  server {&lt;br /&gt;
    server_name two.org;&lt;br /&gt;
    access_log logs/two.access;&lt;br /&gt;
    error_log logs/two.error error;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way, a request for &amp;lt;code&amp;gt;one.org/nonexistent.html&amp;lt;/code&amp;gt; file will output the following error in &amp;lt;code&amp;gt;logs/one.error&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;2009/01/01 19:45:44 [error]  29874#0: *98 open() &amp;quot;/var/www/one/nonexistent.html&amp;quot; failed (2: No such file or directory), client: 11.22.33.44, server: one.org, request: &amp;quot;GET /nonexistent.html HTTP/1.1&amp;quot;, host: &amp;quot;one.org&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>