Empty error log

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;
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;
}
}

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

— Original message —
From: “chAlx” [email protected]
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;
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 need to be rewritten in
/index.php?router=goods/foo/bar and passed to php-server.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs