either error log empty or access log empty

Francis Daly francis at daoine.org
Sat Mar 24 12:46:00 UTC 2012

On Fri, Mar 23, 2012 at 08:48:11PM -0400, zhnupy wrote:

Hi there,

> eventhough I have similar log configuration on all virtual hosts either
> access.log is always empty or error.log is always empty on each virtual
> hosts. 

I fail to reproduce the problem you report with the configuration you

> I better explain with facts, this is nginx configuration ( I'm just
> copying relevant parts please disregard any syntax error I might have
> introduced by doing this) :

Either you've left out a relevant part, or there is some other difference
in our test cases. nginx -V, perhaps?

Can you provide a (minimal) config that shows the problem for you?

> Now, I use wget to make a request for a non existent file and get a 404
> response
> wget http://www.HOST_A.com/nonexistentfile.php
> wget http://www.HOST_B.com/nonexistentfile.php
> wget http://www.HOST_C.com/nonexistentfile.php
> ls command output shows that for HOST_A only error.log gets updated, and
> for HOST_B and HOST_C only access.log gets updated

If nginx returns 404, access_log should be written.

For HOST_A, have you any other access_log defined that is used instead?

If nginx tries to read a missing file, error_log should be
written. "try_files" and "fastcgi_pass" don't involve nginx trying to
read a file. Are you using either of those in the HOST_B and HOST_C
configs? Or have you any other error_log defined?

> I'd deeply appreciate any suggestions on this issue

More information needed; ideally a config that you confirm shows the
problem. Does it fail with only one server{} block? Or with two?

Francis Daly        francis at daoine.org

More information about the nginx mailing list