# Empty error log

**URL:** <https://www.ruby-forum.com/t/empty-error-log/238394>\
**Category:** NGINX\
**Created:** [January 8, 2014, 10:08am UTC](https://www.ruby-forum.com/t/empty-error-log/238394 "2014-01-08T10:08:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [January 8, 2014, 10:08am UTC](https://www.ruby-forum.com/t/empty-error-log/238394/1 "2014-01-08T10:08:47Z")

</div>

I have installed Nginx for a small web server with static content. It  
works fine but the site error log file is always empty. All errors such  
as 404 are written to the access log only. File grants are the same for  
access and error logs.

I’ve tried to change error\_log param from “error” to “warn” and that  
didn’t help. But changing it to “debug” was successful: log was filled  
with debug info (but no error info).

My config files:

/etc/nginx/nginx.conf:

user www;  
worker\_processes 2;  
pid /var/run/nginx.pid;

events {  
worker\_connections 768;  
}

http {  
sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;  
keepalive\_timeout 65;  
types\_hash\_max\_size 2048;  
server\_tokens off;  
include /etc/nginx/mime.types;  
default\_type application/octet-stream;  
access\_log /var/log/nginx/access.log;  
error\_log /var/log/nginx/error.log;  
gzip on;  
gzip\_disable “msie6”;  
gzip\_min\_length 200;  
gzip\_types text/plain text/css application/json  
application/x-javascript text/xml application/xml application/xml+rss  
text/javascript application/rdf+xml;

include/etc/nginx/conf.d/_.conf; # None  
include/etc/nginx/sites-enabled/_; # One  
}

/etc/nginx/sites-available/mysite.conf:

server {  
listen 80;  
root /var/www/mysite;  
index index.html index.htm;  
server\_name [mysite.org](http://mysite.org);  
access\_log /var/log/nginx/mysite\_access.log combined;  
error\_log /var/log/nginx/mysite\_error.log error;  
log\_subrequest on;  
location / {  
try\_files $uri $uri/ =404;  
autoindex off;  
}  
}

---

<div class="post-metadata">

**Author:** ![chAlx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chAlx](https://www.ruby-forum.com/u/chAlx)\
**Post date:** [January 8, 2014, 10:19am UTC](https://www.ruby-forum.com/t/empty-error-log/238394/2 "2014-01-08T10:19:53Z")

</div>

On Wednesday 08 January 2014 13:07:50 chAlx wrote:

> I have installed Nginx for a small web server with static content. It works  
> fine but the site error log file is always empty. All errors such as 404  
> are written to the access log only. File grants are the same for access and  
> error logs.
> 
> I’ve tried to change error\_log param from “error” to “warn” and that didn’t  
> help. But changing it to “debug” was successful: log was filled with debug  
> info (but no error info).
> 
> My config files:  
> […]  
> location / {  
> try\_files $uri $uri/ =404;

You should remove “try\_files” directive if you want to see file access  
errors  
in the error log.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![chAlx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chAlx](https://www.ruby-forum.com/u/chAlx)\
**Post date:** [January 8, 2014, 10:33am UTC](https://www.ruby-forum.com/t/empty-error-log/238394/3 "2014-01-08T10:33:55Z")

</div>

— Original message —  
From: “chAlx” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: 8 January 2014, 11:08:35

> worker\_processes 2;  
> keepalive\_timeout 65;  
> application/x-javascript text/xml application/xml application/xml+rss  
> listen 80;  
> root /var/www/mysite;  
> index index.html index.htm;  
> server\_name [mysite.org](http://mysite.org);  
> access\_log /var/log/nginx/mysite\_access.log combined;  
> error\_log /var/log/nginx/mysite\_error.log error;  
> log\_subrequest on;  
> location / {  
> try\_files $uri $uri/ =404;  
> autoindex off;  
> }

Use try\_files if you need rewriting rules.

E.g. [http://myshop.com/goods/foo/bar](http://myshop.com/goods/foo/bar) need to be rewritten in  
/index.php?router=goods/foo/bar and passed to php-server.
